QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#594812 | #9220. Bus Analysis | forgotmyhandle | Compile Error | / | / | C++14 | 1.5kb | 2024-09-28 10:30:57 | 2024-09-28 10:30:59 |
Judging History
answer
#include <iostream>
#define int long long
using namespace std;
const int P = 1000000007;
inline void Madd(int& x, int y) { (x += y) >= P ? (x -= P) : 0; }
int n;
int dp[2][80][80][80];
int pw[1005];
int x[1005];
signed main() {
cin >> n;
for (int i = 1; i <= n; i++) cin >> x[i];
pw[0] = 1;
for (int i = 1; i <= n; i++) pw[i] = pw[i - 1] * 2 % P;
dp[0][0][0][0] = 1;
int ans = 0;
for (int i = 1; i <= n; i++) {
int d = x[i] - x[i - 1];
memset(dp[1], 0, sizeof dp[1]);
for (int a = 0; a <= 75; a++) {
for (int b = 0; b <= 75; b++) {
for (int c = 0; c <= 75; c++) {
if (!dp[0][a][b][c])
continue;
static int f[6];
f[0] = max(0ll, a - d), f[1] = max(0ll, b - d), f[2] = max(0ll, c - d);
for (int i = 0; i < 5; i++) {
f[i + 1] = max(f[i + 1], f[i] + 20);
if (i + 3 < 6)
f[i + 3] = max(f[i + 3], f[i] + 75);
}
Madd(dp[1][f[0]][f[1]][f[2]], dp[0][a][b][c]);
int j = 0;
while (!f[j]) ++j;
Madd(ans, j * dp[0][a][b][c] % P * pw[n - i] % P);
Madd(dp[1][f[j]][f[j + 1]][f[j + 2]], dp[0][a][b][c]);
}
}
}
}
cout << (ans << 1) % P << "\n";
return 0;
}
Details
answer.code: In function ‘int main()’: answer.code:19:9: error: ‘memset’ was not declared in this scope 19 | memset(dp[1], 0, sizeof dp[1]); | ^~~~~~ answer.code:2:1: note: ‘memset’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’? 1 | #include <iostream> +++ |+#include <cstring> 2 | #define int long long