# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
59783 | 2018-07-23T06:02:34 Z | 강태규(#1723) | Sparklers (JOI17_sparklers) | C++11 | 181 ms | 5076 KB |
#include <iostream> #include <algorithm> #include <vector> #include <queue> #include <deque> #include <set> #include <map> #include <unordered_map> #include <functional> #include <cstring> #include <cmath> #include <ctime> #include <cstdlib> using namespace std; typedef long long llong; typedef long double ld; typedef pair<int, int> pii; typedef pair<llong, llong> pll; int n, k, t; int x[100001]; int dp[1001][1001]; const int inf = 1e9 + 7; llong a[100001]; int check(int s) { for (int i = 1; i <= n; ++i) { a[i] = 2ll * i * t * s - x[i]; } dp[k][k] = 1; for (int l = 1; l < n; ++l) { for (int i = 1; i + l <= n; ++i) { dp[i][i + l] = 0; if (a[i] <= a[i + l]) { if (dp[i + 1][i + l] || dp[i][i + l - 1]) dp[i][i + l] = 1; } } } return dp[1][n]; } int main() { scanf("%d%d%d", &n, &k, &t); if (n > 2000) return 0; for (int i = 1; i <= n; ++i) { scanf("%d", x + i); } if (x[n] == 0) { printf("0\n"); return 0; } int s = 1, e = inf / t + 1; while (s < e) { int m = (s + e) / 2; if (check(m)) e = m; else s = m + 1; } printf("%d\n", s); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 288 KB | Output is correct |
2 | Correct | 2 ms | 484 KB | Output is correct |
3 | Correct | 2 ms | 484 KB | Output is correct |
4 | Correct | 2 ms | 484 KB | Output is correct |
5 | Correct | 3 ms | 484 KB | Output is correct |
6 | Correct | 2 ms | 524 KB | Output is correct |
7 | Correct | 2 ms | 548 KB | Output is correct |
8 | Correct | 2 ms | 548 KB | Output is correct |
9 | Correct | 3 ms | 596 KB | Output is correct |
10 | Correct | 2 ms | 620 KB | Output is correct |
11 | Correct | 3 ms | 620 KB | Output is correct |
12 | Correct | 2 ms | 620 KB | Output is correct |
13 | Correct | 3 ms | 620 KB | Output is correct |
14 | Correct | 2 ms | 620 KB | Output is correct |
15 | Correct | 5 ms | 620 KB | Output is correct |
16 | Correct | 3 ms | 620 KB | Output is correct |
17 | Correct | 3 ms | 620 KB | Output is correct |
18 | Correct | 3 ms | 620 KB | Output is correct |
19 | Correct | 3 ms | 620 KB | Output is correct |
20 | Correct | 4 ms | 644 KB | Output is correct |
21 | Correct | 5 ms | 664 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 288 KB | Output is correct |
2 | Correct | 2 ms | 484 KB | Output is correct |
3 | Correct | 2 ms | 484 KB | Output is correct |
4 | Correct | 2 ms | 484 KB | Output is correct |
5 | Correct | 3 ms | 484 KB | Output is correct |
6 | Correct | 2 ms | 524 KB | Output is correct |
7 | Correct | 2 ms | 548 KB | Output is correct |
8 | Correct | 2 ms | 548 KB | Output is correct |
9 | Correct | 3 ms | 596 KB | Output is correct |
10 | Correct | 2 ms | 620 KB | Output is correct |
11 | Correct | 3 ms | 620 KB | Output is correct |
12 | Correct | 2 ms | 620 KB | Output is correct |
13 | Correct | 3 ms | 620 KB | Output is correct |
14 | Correct | 2 ms | 620 KB | Output is correct |
15 | Correct | 5 ms | 620 KB | Output is correct |
16 | Correct | 3 ms | 620 KB | Output is correct |
17 | Correct | 3 ms | 620 KB | Output is correct |
18 | Correct | 3 ms | 620 KB | Output is correct |
19 | Correct | 3 ms | 620 KB | Output is correct |
20 | Correct | 4 ms | 644 KB | Output is correct |
21 | Correct | 5 ms | 664 KB | Output is correct |
22 | Correct | 41 ms | 3636 KB | Output is correct |
23 | Correct | 18 ms | 3636 KB | Output is correct |
24 | Correct | 36 ms | 3700 KB | Output is correct |
25 | Correct | 154 ms | 4604 KB | Output is correct |
26 | Correct | 150 ms | 4616 KB | Output is correct |
27 | Correct | 157 ms | 4748 KB | Output is correct |
28 | Correct | 137 ms | 4748 KB | Output is correct |
29 | Correct | 170 ms | 4776 KB | Output is correct |
30 | Correct | 163 ms | 4784 KB | Output is correct |
31 | Correct | 168 ms | 4796 KB | Output is correct |
32 | Correct | 145 ms | 4832 KB | Output is correct |
33 | Correct | 149 ms | 4840 KB | Output is correct |
34 | Correct | 149 ms | 4852 KB | Output is correct |
35 | Correct | 181 ms | 4864 KB | Output is correct |
36 | Correct | 133 ms | 4864 KB | Output is correct |
37 | Correct | 162 ms | 5016 KB | Output is correct |
38 | Correct | 145 ms | 5064 KB | Output is correct |
39 | Correct | 150 ms | 5076 KB | Output is correct |
40 | Correct | 4 ms | 5076 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 288 KB | Output is correct |
2 | Correct | 2 ms | 484 KB | Output is correct |
3 | Correct | 2 ms | 484 KB | Output is correct |
4 | Correct | 2 ms | 484 KB | Output is correct |
5 | Correct | 3 ms | 484 KB | Output is correct |
6 | Correct | 2 ms | 524 KB | Output is correct |
7 | Correct | 2 ms | 548 KB | Output is correct |
8 | Correct | 2 ms | 548 KB | Output is correct |
9 | Correct | 3 ms | 596 KB | Output is correct |
10 | Correct | 2 ms | 620 KB | Output is correct |
11 | Correct | 3 ms | 620 KB | Output is correct |
12 | Correct | 2 ms | 620 KB | Output is correct |
13 | Correct | 3 ms | 620 KB | Output is correct |
14 | Correct | 2 ms | 620 KB | Output is correct |
15 | Correct | 5 ms | 620 KB | Output is correct |
16 | Correct | 3 ms | 620 KB | Output is correct |
17 | Correct | 3 ms | 620 KB | Output is correct |
18 | Correct | 3 ms | 620 KB | Output is correct |
19 | Correct | 3 ms | 620 KB | Output is correct |
20 | Correct | 4 ms | 644 KB | Output is correct |
21 | Correct | 5 ms | 664 KB | Output is correct |
22 | Correct | 41 ms | 3636 KB | Output is correct |
23 | Correct | 18 ms | 3636 KB | Output is correct |
24 | Correct | 36 ms | 3700 KB | Output is correct |
25 | Correct | 154 ms | 4604 KB | Output is correct |
26 | Correct | 150 ms | 4616 KB | Output is correct |
27 | Correct | 157 ms | 4748 KB | Output is correct |
28 | Correct | 137 ms | 4748 KB | Output is correct |
29 | Correct | 170 ms | 4776 KB | Output is correct |
30 | Correct | 163 ms | 4784 KB | Output is correct |
31 | Correct | 168 ms | 4796 KB | Output is correct |
32 | Correct | 145 ms | 4832 KB | Output is correct |
33 | Correct | 149 ms | 4840 KB | Output is correct |
34 | Correct | 149 ms | 4852 KB | Output is correct |
35 | Correct | 181 ms | 4864 KB | Output is correct |
36 | Correct | 133 ms | 4864 KB | Output is correct |
37 | Correct | 162 ms | 5016 KB | Output is correct |
38 | Correct | 145 ms | 5064 KB | Output is correct |
39 | Correct | 150 ms | 5076 KB | Output is correct |
40 | Correct | 4 ms | 5076 KB | Output is correct |
41 | Incorrect | 2 ms | 5076 KB | Output isn't correct |
42 | Halted | 0 ms | 0 KB | - |