# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
59941 | 2018-07-23T11:01:09 Z | ainta(#1720) | Sparklers (JOI17_sparklers) | C++11 | 361 ms | 16568 KB |
#include<cstdio> #include<algorithm> #define N_ 1010 using namespace std; int n, st; long long T, X[N_], B[N_][N_], E[N_][N_], INF = 1e9; bool Pos(long long KK) { long long L = T*KK; if (L >= 1e9)return true; int i, j; for (i = 1; i <= n; i++)for (j = 1; j <= n; j++)B[i][j] = INF, E[i][j] = 0; B[st][st] = E[st][st] = X[st]; for (i = st; i >= 1; i--)for (j = st; j <= n; j++) { if (B[i][j] > E[i][j])continue; int t = j - i; if (j != n) { long long bb = max(max(0ll, X[j + 1] - (t + 1)*L), B[i][j] - L); long long ee = min(INF, E[i][j] + L); B[i][j + 1] = min(B[i][j + 1], bb); E[i][j + 1] = max(E[i][j + 1], ee); } if (i != 1) { long long bb = max(0ll, B[i][j] - L); long long ee = min(min(INF, X[i - 1] + (t + 1)*L), E[i][j] + L); B[i - 1][j] = min(B[i - 1][j], bb); E[i - 1][j] = max(E[i - 1][j], ee); } } if (B[1][n] <= E[1][n])return true; return false; } int main() { int i; scanf("%d%d%lld", &n, &st, &T); for (i = 1; i <= n; i++) { scanf("%lld", &X[i]); } long long b = 0, e = 1e9, mid, res; while (b <= e) { mid = (b + e) / 2; if (Pos(mid)) { res = mid; e = mid - 1; } else b = mid + 1; } printf("%d\n", res); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 376 KB | Output is correct |
2 | Correct | 3 ms | 376 KB | Output is correct |
3 | Correct | 3 ms | 572 KB | Output is correct |
4 | Correct | 2 ms | 644 KB | Output is correct |
5 | Correct | 3 ms | 668 KB | Output is correct |
6 | Correct | 4 ms | 676 KB | Output is correct |
7 | Correct | 4 ms | 676 KB | Output is correct |
8 | Correct | 2 ms | 680 KB | Output is correct |
9 | Correct | 3 ms | 684 KB | Output is correct |
10 | Correct | 3 ms | 688 KB | Output is correct |
11 | Correct | 3 ms | 716 KB | Output is correct |
12 | Correct | 3 ms | 892 KB | Output is correct |
13 | Correct | 2 ms | 892 KB | Output is correct |
14 | Correct | 3 ms | 892 KB | Output is correct |
15 | Correct | 2 ms | 892 KB | Output is correct |
16 | Correct | 2 ms | 892 KB | Output is correct |
17 | Correct | 3 ms | 892 KB | Output is correct |
18 | Correct | 2 ms | 892 KB | Output is correct |
19 | Correct | 2 ms | 912 KB | Output is correct |
20 | Correct | 2 ms | 912 KB | Output is correct |
21 | Correct | 3 ms | 912 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 376 KB | Output is correct |
2 | Correct | 3 ms | 376 KB | Output is correct |
3 | Correct | 3 ms | 572 KB | Output is correct |
4 | Correct | 2 ms | 644 KB | Output is correct |
5 | Correct | 3 ms | 668 KB | Output is correct |
6 | Correct | 4 ms | 676 KB | Output is correct |
7 | Correct | 4 ms | 676 KB | Output is correct |
8 | Correct | 2 ms | 680 KB | Output is correct |
9 | Correct | 3 ms | 684 KB | Output is correct |
10 | Correct | 3 ms | 688 KB | Output is correct |
11 | Correct | 3 ms | 716 KB | Output is correct |
12 | Correct | 3 ms | 892 KB | Output is correct |
13 | Correct | 2 ms | 892 KB | Output is correct |
14 | Correct | 3 ms | 892 KB | Output is correct |
15 | Correct | 2 ms | 892 KB | Output is correct |
16 | Correct | 2 ms | 892 KB | Output is correct |
17 | Correct | 3 ms | 892 KB | Output is correct |
18 | Correct | 2 ms | 892 KB | Output is correct |
19 | Correct | 2 ms | 912 KB | Output is correct |
20 | Correct | 2 ms | 912 KB | Output is correct |
21 | Correct | 3 ms | 912 KB | Output is correct |
22 | Correct | 124 ms | 12324 KB | Output is correct |
23 | Correct | 61 ms | 12324 KB | Output is correct |
24 | Correct | 101 ms | 12324 KB | Output is correct |
25 | Correct | 176 ms | 16420 KB | Output is correct |
26 | Correct | 185 ms | 16480 KB | Output is correct |
27 | Correct | 199 ms | 16484 KB | Output is correct |
28 | Correct | 207 ms | 16484 KB | Output is correct |
29 | Correct | 231 ms | 16556 KB | Output is correct |
30 | Correct | 266 ms | 16556 KB | Output is correct |
31 | Correct | 240 ms | 16556 KB | Output is correct |
32 | Correct | 232 ms | 16556 KB | Output is correct |
33 | Correct | 217 ms | 16556 KB | Output is correct |
34 | Correct | 203 ms | 16568 KB | Output is correct |
35 | Correct | 243 ms | 16568 KB | Output is correct |
36 | Correct | 175 ms | 16568 KB | Output is correct |
37 | Correct | 167 ms | 16568 KB | Output is correct |
38 | Correct | 361 ms | 16568 KB | Output is correct |
39 | Correct | 163 ms | 16568 KB | Output is correct |
40 | Correct | 240 ms | 16568 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 376 KB | Output is correct |
2 | Correct | 3 ms | 376 KB | Output is correct |
3 | Correct | 3 ms | 572 KB | Output is correct |
4 | Correct | 2 ms | 644 KB | Output is correct |
5 | Correct | 3 ms | 668 KB | Output is correct |
6 | Correct | 4 ms | 676 KB | Output is correct |
7 | Correct | 4 ms | 676 KB | Output is correct |
8 | Correct | 2 ms | 680 KB | Output is correct |
9 | Correct | 3 ms | 684 KB | Output is correct |
10 | Correct | 3 ms | 688 KB | Output is correct |
11 | Correct | 3 ms | 716 KB | Output is correct |
12 | Correct | 3 ms | 892 KB | Output is correct |
13 | Correct | 2 ms | 892 KB | Output is correct |
14 | Correct | 3 ms | 892 KB | Output is correct |
15 | Correct | 2 ms | 892 KB | Output is correct |
16 | Correct | 2 ms | 892 KB | Output is correct |
17 | Correct | 3 ms | 892 KB | Output is correct |
18 | Correct | 2 ms | 892 KB | Output is correct |
19 | Correct | 2 ms | 912 KB | Output is correct |
20 | Correct | 2 ms | 912 KB | Output is correct |
21 | Correct | 3 ms | 912 KB | Output is correct |
22 | Correct | 124 ms | 12324 KB | Output is correct |
23 | Correct | 61 ms | 12324 KB | Output is correct |
24 | Correct | 101 ms | 12324 KB | Output is correct |
25 | Correct | 176 ms | 16420 KB | Output is correct |
26 | Correct | 185 ms | 16480 KB | Output is correct |
27 | Correct | 199 ms | 16484 KB | Output is correct |
28 | Correct | 207 ms | 16484 KB | Output is correct |
29 | Correct | 231 ms | 16556 KB | Output is correct |
30 | Correct | 266 ms | 16556 KB | Output is correct |
31 | Correct | 240 ms | 16556 KB | Output is correct |
32 | Correct | 232 ms | 16556 KB | Output is correct |
33 | Correct | 217 ms | 16556 KB | Output is correct |
34 | Correct | 203 ms | 16568 KB | Output is correct |
35 | Correct | 243 ms | 16568 KB | Output is correct |
36 | Correct | 175 ms | 16568 KB | Output is correct |
37 | Correct | 167 ms | 16568 KB | Output is correct |
38 | Correct | 361 ms | 16568 KB | Output is correct |
39 | Correct | 163 ms | 16568 KB | Output is correct |
40 | Correct | 240 ms | 16568 KB | Output is correct |
41 | Runtime error | 3 ms | 16568 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
42 | Halted | 0 ms | 0 KB | - |