# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
20973 | 2017-03-26T03:39:26 Z | undecember | 격자 보존하기 (GA9_preserve) | C++14 | 36 ms | 2408 KB |
#include <bits/stdc++.h> using namespace std; int n, k, d; int mp[2], kp[100005]; int main(void) { scanf("%d%d%d", &n, &k, &d); int ans = INT_MIN; int lp; scanf("%d", &lp); mp[0] = lp - 1; for (int i = 0; i < k - 1; i++) { scanf("%d", &kp[i]); kp[i] = kp[i] - lp - 1; lp = kp[i] + lp + 1; } mp[1] = n - lp; sort(mp, mp + 2); sort(kp, kp + (k - 1)); int rst = 2 * k - d; for (int i = 0; i < 2; i++) { for (int j = 0; j < 2; j++) { int tv = n - k - i * mp[0] - j * mp[1]; int r = rst - i - j; int ti = 0, ki; for (ki = 0; r > 0; ki++) { tv -= kp[ki]; r -= 2; } if (r % 2) tv -= kp[ki]; if (tv > ans) ans = tv; } } printf("%d", ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2408 KB | Output is correct |
2 | Correct | 0 ms | 2408 KB | Output is correct |
3 | Correct | 0 ms | 2408 KB | Output is correct |
4 | Correct | 0 ms | 2408 KB | Output is correct |
5 | Correct | 0 ms | 2408 KB | Output is correct |
6 | Correct | 0 ms | 2408 KB | Output is correct |
7 | Correct | 0 ms | 2408 KB | Output is correct |
8 | Incorrect | 0 ms | 2408 KB | Output isn't correct |
9 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2408 KB | Output is correct |
2 | Correct | 0 ms | 2408 KB | Output is correct |
3 | Correct | 0 ms | 2408 KB | Output is correct |
4 | Correct | 0 ms | 2408 KB | Output is correct |
5 | Correct | 0 ms | 2408 KB | Output is correct |
6 | Correct | 0 ms | 2408 KB | Output is correct |
7 | Correct | 0 ms | 2408 KB | Output is correct |
8 | Correct | 0 ms | 2408 KB | Output is correct |
9 | Correct | 0 ms | 2408 KB | Output is correct |
10 | Correct | 0 ms | 2408 KB | Output is correct |
11 | Correct | 0 ms | 2408 KB | Output is correct |
12 | Correct | 0 ms | 2408 KB | Output is correct |
13 | Correct | 0 ms | 2408 KB | Output is correct |
14 | Correct | 0 ms | 2408 KB | Output is correct |
15 | Correct | 0 ms | 2408 KB | Output is correct |
16 | Correct | 0 ms | 2408 KB | Output is correct |
17 | Correct | 0 ms | 2408 KB | Output is correct |
18 | Correct | 0 ms | 2408 KB | Output is correct |
19 | Correct | 0 ms | 2408 KB | Output is correct |
20 | Correct | 0 ms | 2408 KB | Output is correct |
21 | Correct | 0 ms | 2408 KB | Output is correct |
22 | Correct | 0 ms | 2408 KB | Output is correct |
23 | Correct | 0 ms | 2408 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2408 KB | Output is correct |
2 | Correct | 0 ms | 2408 KB | Output is correct |
3 | Correct | 0 ms | 2408 KB | Output is correct |
4 | Correct | 0 ms | 2408 KB | Output is correct |
5 | Correct | 0 ms | 2408 KB | Output is correct |
6 | Correct | 0 ms | 2408 KB | Output is correct |
7 | Correct | 0 ms | 2408 KB | Output is correct |
8 | Correct | 0 ms | 2408 KB | Output is correct |
9 | Correct | 0 ms | 2408 KB | Output is correct |
10 | Correct | 0 ms | 2408 KB | Output is correct |
11 | Correct | 0 ms | 2408 KB | Output is correct |
12 | Correct | 0 ms | 2408 KB | Output is correct |
13 | Correct | 0 ms | 2408 KB | Output is correct |
14 | Correct | 0 ms | 2408 KB | Output is correct |
15 | Correct | 0 ms | 2408 KB | Output is correct |
16 | Correct | 0 ms | 2408 KB | Output is correct |
17 | Correct | 0 ms | 2408 KB | Output is correct |
18 | Correct | 0 ms | 2408 KB | Output is correct |
19 | Correct | 0 ms | 2408 KB | Output is correct |
20 | Correct | 0 ms | 2408 KB | Output is correct |
21 | Correct | 0 ms | 2408 KB | Output is correct |
22 | Correct | 0 ms | 2408 KB | Output is correct |
23 | Incorrect | 0 ms | 2408 KB | Output isn't correct |
24 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 23 ms | 2408 KB | Output is correct |
2 | Correct | 26 ms | 2408 KB | Output is correct |
3 | Correct | 26 ms | 2408 KB | Output is correct |
4 | Correct | 23 ms | 2408 KB | Output is correct |
5 | Correct | 29 ms | 2408 KB | Output is correct |
6 | Correct | 36 ms | 2408 KB | Output is correct |
7 | Correct | 26 ms | 2408 KB | Output is correct |
8 | Correct | 29 ms | 2408 KB | Output is correct |
9 | Correct | 16 ms | 2408 KB | Output is correct |
10 | Correct | 6 ms | 2408 KB | Output is correct |
11 | Correct | 23 ms | 2408 KB | Output is correct |
12 | Correct | 26 ms | 2408 KB | Output is correct |
13 | Correct | 23 ms | 2408 KB | Output is correct |
14 | Correct | 23 ms | 2408 KB | Output is correct |
15 | Correct | 26 ms | 2408 KB | Output is correct |
16 | Correct | 23 ms | 2408 KB | Output is correct |
17 | Correct | 19 ms | 2408 KB | Output is correct |
18 | Correct | 33 ms | 2408 KB | Output is correct |
19 | Correct | 26 ms | 2408 KB | Output is correct |
20 | Correct | 0 ms | 2408 KB | Output is correct |
21 | Correct | 0 ms | 2408 KB | Output is correct |
22 | Correct | 23 ms | 2408 KB | Output is correct |
23 | Correct | 29 ms | 2408 KB | Output is correct |
24 | Correct | 23 ms | 2408 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 23 ms | 2408 KB | Output is correct |
2 | Correct | 26 ms | 2408 KB | Output is correct |
3 | Correct | 29 ms | 2408 KB | Output is correct |
4 | Correct | 23 ms | 2408 KB | Output is correct |
5 | Correct | 26 ms | 2408 KB | Output is correct |
6 | Correct | 26 ms | 2408 KB | Output is correct |
7 | Correct | 23 ms | 2408 KB | Output is correct |
8 | Correct | 26 ms | 2408 KB | Output is correct |
9 | Correct | 13 ms | 2408 KB | Output is correct |
10 | Correct | 3 ms | 2408 KB | Output is correct |
11 | Correct | 16 ms | 2408 KB | Output is correct |
12 | Correct | 19 ms | 2408 KB | Output is correct |
13 | Correct | 16 ms | 2408 KB | Output is correct |
14 | Correct | 19 ms | 2408 KB | Output is correct |
15 | Correct | 9 ms | 2408 KB | Output is correct |
16 | Correct | 19 ms | 2408 KB | Output is correct |
17 | Correct | 26 ms | 2408 KB | Output is correct |
18 | Correct | 13 ms | 2408 KB | Output is correct |
19 | Correct | 23 ms | 2408 KB | Output is correct |
20 | Correct | 19 ms | 2408 KB | Output is correct |