# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
46891 | 2018-04-24T14:47:25 Z | SpaimaCarpatilor | Sparklers (JOI17_sparklers) | C++17 | 11 ms | 4672 KB |
#include<bits/stdc++.h> using namespace std; int N, K, T, x[100009]; bool dp[2018][2018]; bool ok (int S) { memset (dp, 0, sizeof (dp)); dp[K][K] = 1;///j is the last visited for (int i=K; i>=1; i--) for (int j=K; j<=N; j++) { if (x[j] - x[i] > 2LL * S * T * (j - i) || dp[i][j] == 0) { dp[i][j] = 0; continue; } dp[i - 1][j] |= dp[i][j], dp[i][j + 1] |= dp[i][j]; } return dp[1][N]; } int main () { //freopen ("input", "r", stdin); //freopen ("output", "w", stdout); scanf ("%d %d %d", &N, &K, &T); for (int i=1; i<=N; i++) scanf ("%d", &x[i]); int p = 1, u = (x[N] - x[1]) / T + 1, mij, ras = -1; while (p <= u) { mij = (p + u) >> 1; if (ok (mij)) ras = mij, u = mij - 1; else p = mij + 1; } printf ("%d\n", ras); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 4344 KB | Output is correct |
2 | Correct | 9 ms | 4344 KB | Output is correct |
3 | Correct | 10 ms | 4532 KB | Output is correct |
4 | Correct | 10 ms | 4532 KB | Output is correct |
5 | Correct | 10 ms | 4568 KB | Output is correct |
6 | Correct | 9 ms | 4568 KB | Output is correct |
7 | Correct | 11 ms | 4568 KB | Output is correct |
8 | Correct | 11 ms | 4568 KB | Output is correct |
9 | Correct | 10 ms | 4672 KB | Output is correct |
10 | Correct | 9 ms | 4672 KB | Output is correct |
11 | Correct | 11 ms | 4672 KB | Output is correct |
12 | Correct | 10 ms | 4672 KB | Output is correct |
13 | Correct | 11 ms | 4672 KB | Output is correct |
14 | Correct | 11 ms | 4672 KB | Output is correct |
15 | Correct | 9 ms | 4672 KB | Output is correct |
16 | Correct | 9 ms | 4672 KB | Output is correct |
17 | Correct | 11 ms | 4672 KB | Output is correct |
18 | Correct | 10 ms | 4672 KB | Output is correct |
19 | Incorrect | 5 ms | 4672 KB | Output isn't correct |
20 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 4344 KB | Output is correct |
2 | Correct | 9 ms | 4344 KB | Output is correct |
3 | Correct | 10 ms | 4532 KB | Output is correct |
4 | Correct | 10 ms | 4532 KB | Output is correct |
5 | Correct | 10 ms | 4568 KB | Output is correct |
6 | Correct | 9 ms | 4568 KB | Output is correct |
7 | Correct | 11 ms | 4568 KB | Output is correct |
8 | Correct | 11 ms | 4568 KB | Output is correct |
9 | Correct | 10 ms | 4672 KB | Output is correct |
10 | Correct | 9 ms | 4672 KB | Output is correct |
11 | Correct | 11 ms | 4672 KB | Output is correct |
12 | Correct | 10 ms | 4672 KB | Output is correct |
13 | Correct | 11 ms | 4672 KB | Output is correct |
14 | Correct | 11 ms | 4672 KB | Output is correct |
15 | Correct | 9 ms | 4672 KB | Output is correct |
16 | Correct | 9 ms | 4672 KB | Output is correct |
17 | Correct | 11 ms | 4672 KB | Output is correct |
18 | Correct | 10 ms | 4672 KB | Output is correct |
19 | Incorrect | 5 ms | 4672 KB | Output isn't correct |
20 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 4344 KB | Output is correct |
2 | Correct | 9 ms | 4344 KB | Output is correct |
3 | Correct | 10 ms | 4532 KB | Output is correct |
4 | Correct | 10 ms | 4532 KB | Output is correct |
5 | Correct | 10 ms | 4568 KB | Output is correct |
6 | Correct | 9 ms | 4568 KB | Output is correct |
7 | Correct | 11 ms | 4568 KB | Output is correct |
8 | Correct | 11 ms | 4568 KB | Output is correct |
9 | Correct | 10 ms | 4672 KB | Output is correct |
10 | Correct | 9 ms | 4672 KB | Output is correct |
11 | Correct | 11 ms | 4672 KB | Output is correct |
12 | Correct | 10 ms | 4672 KB | Output is correct |
13 | Correct | 11 ms | 4672 KB | Output is correct |
14 | Correct | 11 ms | 4672 KB | Output is correct |
15 | Correct | 9 ms | 4672 KB | Output is correct |
16 | Correct | 9 ms | 4672 KB | Output is correct |
17 | Correct | 11 ms | 4672 KB | Output is correct |
18 | Correct | 10 ms | 4672 KB | Output is correct |
19 | Incorrect | 5 ms | 4672 KB | Output isn't correct |
20 | Halted | 0 ms | 0 KB | - |