球球各位大佬帮我看一下感觉写的没有什么问题
orz orz orz
代码:
#include <stdio.h>
#include <algorithm>
#define int long long
#define line __int128
using namespace std;
int a[1000001], b[1000001], dp[1000001], c[1000001];
int n, p;
signed main() {
scanf("%lld%lld", &n, &p);
for (int i = 1; i <= n; i++)
scanf("%lld", &a[i]);
b[1] = dp[1] = a[1];
for (int i = 2; i <= n; i++) {
dp[i] = max(dp[i - 1] + a[i], a[i]);
b[i] = max(b[i - 1], dp[i]);
}
c[1] = b[1], c[2] = b[1] + a[1];
for (int i = 3; i <= n; i++)
c[i] = max(c[i - 1], c[i - 1] + b[i - 1]);
line ans = c[1];
for (int i = 2; i <= n; i++)
ans = max(ans, (line)(c[i]));
printf("%d", (signed)(ans % p));
}
md这哪里错了呀