QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#821495 | #9220. Bus Analysis | HildaHu | WA | 7ms | 21076kb | C++14 | 1.1kb | 2024-12-19 16:15:23 | 2024-12-19 16:15:25 |
Judging History
answer
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N = 1010, M = 80, mod = 1e9 + 7;
int n, ans, a[N], pw[N], f[N][M][M];
void add(int &x, int y) {x = (x + y) % mod; }
int work(int x, int y) {
return (!x || x + y > 75) ? 0 : x + y;
}
signed main() {
cin >> n;
pw[0] = 1;
for (int i=1; i<=n; ++i) pw[i] = pw[i - 1] * 2 % mod;
for (int i=1; i<=n; ++i) cin >> a[i];
f[0][0][0] = 1;
for (int i=0; i<n; ++i)
for (int j=0; j<=min(75ll,i); ++j) {
int nxt = a[i + 1] + 19;
if (j && nxt < a[i - j + 1] + 74) nxt = a[i - j + 1] + 74;
nxt = upper_bound(a + 1, a + n + 1, nxt) - a - 1;
for (int k=0; k<=min(75ll,i); ++k) if (f[i][k][j]) {
//printf("%d %d %d = %d, nxt %d\n", i, k, j, f[i][k][j], nxt);
add(f[nxt][work(k, nxt - i)][work(j, nxt - i)], f[i][k][j]);
add(f[nxt][nxt - i][work(k, nxt - i)], f[i][k][j] * (pw[nxt - i] - 1));
//printf("add %d %d %d, %d\n", nxt, nxt - i, work(k, nxt - i), f[i][k][j] * (pw[nxt - i] - 1));
add(ans, f[i][k][j] * (pw[nxt - i] - 1) % mod * pw[n - nxt]);
}
}
cout << ans * 2 % mod << "\n";
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3600kb
input:
3 1 8 20
output:
14
result:
ok 1 number(s): "14"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3688kb
input:
5 25 45 65 85 1000000000
output:
156
result:
ok 1 number(s): "156"
Test #3:
score: -100
Wrong Answer
time: 7ms
memory: 21076kb
input:
1000 2 7 9 12 14 17 18 21 22 28 29 33 34 35 37 38 44 45 46 50 58 59 63 66 71 72 75 76 77 78 80 81 83 84 87 92 100 101 107 108 109 112 114 116 118 123 124 131 142 143 144 145 148 150 151 152 153 155 157 158 165 167 168 169 171 176 182 185 190 192 198 202 204 205 212 213 223 224 225 226 229 231 240 24...
output:
615048600
result:
wrong answer 1st numbers differ - expected: '932594593', found: '615048600'