# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
59955 | 2018-07-23T11:23:27 Z | ainta(#1720) | Sparklers (JOI17_sparklers) | C++11 | 49 ms | 4604 KB |
#include<cstdio> #include<algorithm> #define N_ 1010 using namespace std; int n, st; long long T, INF = 1e9, X[N_]; int D[N_][N_]; 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++)D[i][j] = 0; D[st][st] = 1; for (i = st; i >= 1; i--)for (j = st; j <= n; j++) { if (!D[i][j])continue; int t = j - i + 1; if (j != n && X[j + 1] - X[i] <= t*L*2)D[i][j + 1] = 1; if (i != 1 && X[j] - X[i - 1] <= t*L*2)D[i-1][j] = 1; } if (D[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 | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 432 KB | Output is correct |
4 | Correct | 2 ms | 432 KB | Output is correct |
5 | Correct | 3 ms | 480 KB | Output is correct |
6 | Correct | 2 ms | 516 KB | Output is correct |
7 | Correct | 2 ms | 516 KB | Output is correct |
8 | Correct | 2 ms | 544 KB | Output is correct |
9 | Correct | 3 ms | 724 KB | Output is correct |
10 | Correct | 3 ms | 724 KB | Output is correct |
11 | Correct | 2 ms | 724 KB | Output is correct |
12 | Correct | 2 ms | 724 KB | Output is correct |
13 | Correct | 3 ms | 724 KB | Output is correct |
14 | Correct | 3 ms | 724 KB | Output is correct |
15 | Correct | 3 ms | 724 KB | Output is correct |
16 | Correct | 2 ms | 724 KB | Output is correct |
17 | Correct | 3 ms | 724 KB | Output is correct |
18 | Correct | 3 ms | 724 KB | Output is correct |
19 | Correct | 3 ms | 748 KB | Output is correct |
20 | Correct | 2 ms | 748 KB | Output is correct |
21 | Correct | 3 ms | 748 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 432 KB | Output is correct |
4 | Correct | 2 ms | 432 KB | Output is correct |
5 | Correct | 3 ms | 480 KB | Output is correct |
6 | Correct | 2 ms | 516 KB | Output is correct |
7 | Correct | 2 ms | 516 KB | Output is correct |
8 | Correct | 2 ms | 544 KB | Output is correct |
9 | Correct | 3 ms | 724 KB | Output is correct |
10 | Correct | 3 ms | 724 KB | Output is correct |
11 | Correct | 2 ms | 724 KB | Output is correct |
12 | Correct | 2 ms | 724 KB | Output is correct |
13 | Correct | 3 ms | 724 KB | Output is correct |
14 | Correct | 3 ms | 724 KB | Output is correct |
15 | Correct | 3 ms | 724 KB | Output is correct |
16 | Correct | 2 ms | 724 KB | Output is correct |
17 | Correct | 3 ms | 724 KB | Output is correct |
18 | Correct | 3 ms | 724 KB | Output is correct |
19 | Correct | 3 ms | 748 KB | Output is correct |
20 | Correct | 2 ms | 748 KB | Output is correct |
21 | Correct | 3 ms | 748 KB | Output is correct |
22 | Correct | 30 ms | 3452 KB | Output is correct |
23 | Correct | 15 ms | 3452 KB | Output is correct |
24 | Correct | 18 ms | 3500 KB | Output is correct |
25 | Correct | 33 ms | 4604 KB | Output is correct |
26 | Correct | 39 ms | 4604 KB | Output is correct |
27 | Correct | 31 ms | 4604 KB | Output is correct |
28 | Correct | 43 ms | 4604 KB | Output is correct |
29 | Correct | 41 ms | 4604 KB | Output is correct |
30 | Correct | 33 ms | 4604 KB | Output is correct |
31 | Correct | 36 ms | 4604 KB | Output is correct |
32 | Correct | 45 ms | 4604 KB | Output is correct |
33 | Correct | 49 ms | 4604 KB | Output is correct |
34 | Correct | 32 ms | 4604 KB | Output is correct |
35 | Correct | 37 ms | 4604 KB | Output is correct |
36 | Correct | 28 ms | 4604 KB | Output is correct |
37 | Correct | 36 ms | 4604 KB | Output is correct |
38 | Correct | 40 ms | 4604 KB | Output is correct |
39 | Correct | 32 ms | 4604 KB | Output is correct |
40 | Correct | 43 ms | 4604 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 432 KB | Output is correct |
4 | Correct | 2 ms | 432 KB | Output is correct |
5 | Correct | 3 ms | 480 KB | Output is correct |
6 | Correct | 2 ms | 516 KB | Output is correct |
7 | Correct | 2 ms | 516 KB | Output is correct |
8 | Correct | 2 ms | 544 KB | Output is correct |
9 | Correct | 3 ms | 724 KB | Output is correct |
10 | Correct | 3 ms | 724 KB | Output is correct |
11 | Correct | 2 ms | 724 KB | Output is correct |
12 | Correct | 2 ms | 724 KB | Output is correct |
13 | Correct | 3 ms | 724 KB | Output is correct |
14 | Correct | 3 ms | 724 KB | Output is correct |
15 | Correct | 3 ms | 724 KB | Output is correct |
16 | Correct | 2 ms | 724 KB | Output is correct |
17 | Correct | 3 ms | 724 KB | Output is correct |
18 | Correct | 3 ms | 724 KB | Output is correct |
19 | Correct | 3 ms | 748 KB | Output is correct |
20 | Correct | 2 ms | 748 KB | Output is correct |
21 | Correct | 3 ms | 748 KB | Output is correct |
22 | Correct | 30 ms | 3452 KB | Output is correct |
23 | Correct | 15 ms | 3452 KB | Output is correct |
24 | Correct | 18 ms | 3500 KB | Output is correct |
25 | Correct | 33 ms | 4604 KB | Output is correct |
26 | Correct | 39 ms | 4604 KB | Output is correct |
27 | Correct | 31 ms | 4604 KB | Output is correct |
28 | Correct | 43 ms | 4604 KB | Output is correct |
29 | Correct | 41 ms | 4604 KB | Output is correct |
30 | Correct | 33 ms | 4604 KB | Output is correct |
31 | Correct | 36 ms | 4604 KB | Output is correct |
32 | Correct | 45 ms | 4604 KB | Output is correct |
33 | Correct | 49 ms | 4604 KB | Output is correct |
34 | Correct | 32 ms | 4604 KB | Output is correct |
35 | Correct | 37 ms | 4604 KB | Output is correct |
36 | Correct | 28 ms | 4604 KB | Output is correct |
37 | Correct | 36 ms | 4604 KB | Output is correct |
38 | Correct | 40 ms | 4604 KB | Output is correct |
39 | Correct | 32 ms | 4604 KB | Output is correct |
40 | Correct | 43 ms | 4604 KB | Output is correct |
41 | Runtime error | 3 ms | 4604 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
42 | Halted | 0 ms | 0 KB | - |