# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
114386 | 2019-06-01T07:14:52 Z | sebinkim | World of Tank (innopolis2018_final_E) | C++14 | 3 ms | 512 KB |
#include <bits/stdc++.h> using namespace std; typedef pair <int, int> pii; bool B[1010101][2]; int dp[1010101][2], C[1010101][2]; int n, m1, m2, t; void print(int y) { vector <int> V1; vector <pii> V2; int i; for(i=0; i<=n; i++){ if(C[i][y]){ y = 1 - y; V1.push_back(i); } if(dp[i][y] == 0){ V2.emplace_back(i, y); } } printf("Yes\n"); printf("%d\n", V1.size()); for(int &t: V1) printf("%d ", t); printf("\n"); printf("%d\n", V2.size()); for(pii &t: V2) printf("%d %d\n", t.first, t.second + 1); } int main() { int i, j, x; scanf("%d%d%d%d", &n, &m1, &m2, &t); if(n > 1e6) return 0; for(i=1; i<=m1; i++){ scanf("%d", &x); B[x][0] = 1; } for(i=1; i<=m2; i++){ scanf("%d", &x); B[x][1] = 1; } dp[n + 1][0] = 1e9; dp[n + 1][1] = 1e9; for(i=n; i>=0; i--){ for(j=0; j<2; j++){ if(B[i][j]){ dp[i][j] = min(-1, dp[i + 1][j] - t + 1); if(!B[i][1 - j]){ if(dp[i + 1][1 - j] >= -1 && dp[i][j] < min(-1, dp[i + 1][1 - j] - t + 1)){ C[i][j] = 1; dp[i][j] = min(-1, dp[i + 1][1 - j] - t + 1); } } } else{ dp[i][j] = dp[i + 1][j] + 1; if(!B[i][1 - j]){ if(dp[i + 1][1 - j] >= -1 && dp[i][j] < dp[i + 1][1 - j] + 1){ C[i][j] = 1; dp[i][j] = dp[i + 1][1 - j] + 1; } } } } } if(dp[0][0] >= t) print(0); else if(dp[0][1] >= t) print(1); else printf("No\n"); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | [OK, Yes] n = 20, m1 = 20, m2 = 0, t = 20 |
2 | Correct | 2 ms | 512 KB | [OK, Yes] n = 5000, m1 = 509, m2 = 491, t = 5000 |
3 | Correct | 2 ms | 384 KB | [OK, Yes] n = 5000, m1 = 764, m2 = 736, t = 5000 |
4 | Correct | 2 ms | 384 KB | [OK, Yes] n = 5000, m1 = 698, m2 = 802, t = 5000 |
5 | Correct | 2 ms | 384 KB | [OK, Yes] n = 5000, m1 = 720, m2 = 780, t = 5000 |
6 | Correct | 2 ms | 384 KB | [OK, Yes] n = 5000, m1 = 734, m2 = 766, t = 5000 |
7 | Correct | 3 ms | 384 KB | [OK, Yes] n = 5000, m1 = 997, m2 = 1003, t = 5000 |
8 | Correct | 2 ms | 384 KB | [OK, Yes] n = 5000, m1 = 1021, m2 = 979, t = 5000 |
9 | Correct | 2 ms | 384 KB | [OK, No] n = 5000, m1 = 1006, m2 = 995, t = 5000 |
10 | Correct | 2 ms | 512 KB | [OK, No] n = 5000, m1 = 1017, m2 = 984, t = 5000 |
11 | Correct | 2 ms | 512 KB | [OK, No] n = 5000, m1 = 1495, m2 = 1506, t = 5000 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | [OK, Yes] n = 20, m1 = 20, m2 = 0, t = 20 |
2 | Correct | 2 ms | 512 KB | [OK, Yes] n = 5000, m1 = 509, m2 = 491, t = 5000 |
3 | Correct | 2 ms | 384 KB | [OK, Yes] n = 5000, m1 = 764, m2 = 736, t = 5000 |
4 | Correct | 2 ms | 384 KB | [OK, Yes] n = 5000, m1 = 698, m2 = 802, t = 5000 |
5 | Correct | 2 ms | 384 KB | [OK, Yes] n = 5000, m1 = 720, m2 = 780, t = 5000 |
6 | Correct | 2 ms | 384 KB | [OK, Yes] n = 5000, m1 = 734, m2 = 766, t = 5000 |
7 | Correct | 3 ms | 384 KB | [OK, Yes] n = 5000, m1 = 997, m2 = 1003, t = 5000 |
8 | Correct | 2 ms | 384 KB | [OK, Yes] n = 5000, m1 = 1021, m2 = 979, t = 5000 |
9 | Correct | 2 ms | 384 KB | [OK, No] n = 5000, m1 = 1006, m2 = 995, t = 5000 |
10 | Correct | 2 ms | 512 KB | [OK, No] n = 5000, m1 = 1017, m2 = 984, t = 5000 |
11 | Correct | 2 ms | 512 KB | [OK, No] n = 5000, m1 = 1495, m2 = 1506, t = 5000 |
12 | Correct | 2 ms | 384 KB | [OK, Yes] n = 5000, m1 = 974, m2 = 1026, t = 2501 |
13 | Correct | 2 ms | 384 KB | [OK, Yes] n = 5000, m1 = 1022, m2 = 978, t = 2501 |
14 | Correct | 2 ms | 384 KB | [OK, Yes] n = 5000, m1 = 1019, m2 = 981, t = 2501 |
15 | Correct | 2 ms | 512 KB | [OK, Yes] n = 5000, m1 = 1298, m2 = 1367, t = 2501 |
16 | Correct | 2 ms | 384 KB | [OK, No] n = 5000, m1 = 1301, m2 = 1360, t = 2501 |
17 | Correct | 2 ms | 512 KB | [OK, Yes] n = 5000, m1 = 1320, m2 = 1315, t = 2501 |
18 | Correct | 2 ms | 384 KB | [OK, No] n = 5000, m1 = 1195, m2 = 1135, t = 2501 |
19 | Correct | 2 ms | 384 KB | [OK, No] n = 5000, m1 = 1148, m2 = 1202, t = 2501 |
20 | Correct | 2 ms | 384 KB | [OK, No] n = 5000, m1 = 1147, m2 = 1179, t = 2501 |
21 | Correct | 2 ms | 384 KB | [OK, No] n = 5000, m1 = 1163, m2 = 1146, t = 2501 |
22 | Correct | 2 ms | 384 KB | [OK, No] n = 5000, m1 = 1145, m2 = 1184, t = 2501 |
23 | Correct | 2 ms | 384 KB | [OK, No] n = 5000, m1 = 1172, m2 = 1150, t = 2501 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 384 KB | Tank was blowed at position (1, 17) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | [OK, Yes] n = 20, m1 = 20, m2 = 0, t = 20 |
2 | Correct | 2 ms | 512 KB | [OK, Yes] n = 5000, m1 = 509, m2 = 491, t = 5000 |
3 | Correct | 2 ms | 384 KB | [OK, Yes] n = 5000, m1 = 764, m2 = 736, t = 5000 |
4 | Correct | 2 ms | 384 KB | [OK, Yes] n = 5000, m1 = 698, m2 = 802, t = 5000 |
5 | Correct | 2 ms | 384 KB | [OK, Yes] n = 5000, m1 = 720, m2 = 780, t = 5000 |
6 | Correct | 2 ms | 384 KB | [OK, Yes] n = 5000, m1 = 734, m2 = 766, t = 5000 |
7 | Correct | 3 ms | 384 KB | [OK, Yes] n = 5000, m1 = 997, m2 = 1003, t = 5000 |
8 | Correct | 2 ms | 384 KB | [OK, Yes] n = 5000, m1 = 1021, m2 = 979, t = 5000 |
9 | Correct | 2 ms | 384 KB | [OK, No] n = 5000, m1 = 1006, m2 = 995, t = 5000 |
10 | Correct | 2 ms | 512 KB | [OK, No] n = 5000, m1 = 1017, m2 = 984, t = 5000 |
11 | Correct | 2 ms | 512 KB | [OK, No] n = 5000, m1 = 1495, m2 = 1506, t = 5000 |
12 | Correct | 2 ms | 384 KB | [OK, Yes] n = 5000, m1 = 974, m2 = 1026, t = 2501 |
13 | Correct | 2 ms | 384 KB | [OK, Yes] n = 5000, m1 = 1022, m2 = 978, t = 2501 |
14 | Correct | 2 ms | 384 KB | [OK, Yes] n = 5000, m1 = 1019, m2 = 981, t = 2501 |
15 | Correct | 2 ms | 512 KB | [OK, Yes] n = 5000, m1 = 1298, m2 = 1367, t = 2501 |
16 | Correct | 2 ms | 384 KB | [OK, No] n = 5000, m1 = 1301, m2 = 1360, t = 2501 |
17 | Correct | 2 ms | 512 KB | [OK, Yes] n = 5000, m1 = 1320, m2 = 1315, t = 2501 |
18 | Correct | 2 ms | 384 KB | [OK, No] n = 5000, m1 = 1195, m2 = 1135, t = 2501 |
19 | Correct | 2 ms | 384 KB | [OK, No] n = 5000, m1 = 1148, m2 = 1202, t = 2501 |
20 | Correct | 2 ms | 384 KB | [OK, No] n = 5000, m1 = 1147, m2 = 1179, t = 2501 |
21 | Correct | 2 ms | 384 KB | [OK, No] n = 5000, m1 = 1163, m2 = 1146, t = 2501 |
22 | Correct | 2 ms | 384 KB | [OK, No] n = 5000, m1 = 1145, m2 = 1184, t = 2501 |
23 | Correct | 2 ms | 384 KB | [OK, No] n = 5000, m1 = 1172, m2 = 1150, t = 2501 |
24 | Incorrect | 2 ms | 384 KB | Tank was blowed at position (2, 29) |
25 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | [OK, Yes] n = 20, m1 = 20, m2 = 0, t = 20 |
2 | Correct | 2 ms | 512 KB | [OK, Yes] n = 5000, m1 = 509, m2 = 491, t = 5000 |
3 | Correct | 2 ms | 384 KB | [OK, Yes] n = 5000, m1 = 764, m2 = 736, t = 5000 |
4 | Correct | 2 ms | 384 KB | [OK, Yes] n = 5000, m1 = 698, m2 = 802, t = 5000 |
5 | Correct | 2 ms | 384 KB | [OK, Yes] n = 5000, m1 = 720, m2 = 780, t = 5000 |
6 | Correct | 2 ms | 384 KB | [OK, Yes] n = 5000, m1 = 734, m2 = 766, t = 5000 |
7 | Correct | 3 ms | 384 KB | [OK, Yes] n = 5000, m1 = 997, m2 = 1003, t = 5000 |
8 | Correct | 2 ms | 384 KB | [OK, Yes] n = 5000, m1 = 1021, m2 = 979, t = 5000 |
9 | Correct | 2 ms | 384 KB | [OK, No] n = 5000, m1 = 1006, m2 = 995, t = 5000 |
10 | Correct | 2 ms | 512 KB | [OK, No] n = 5000, m1 = 1017, m2 = 984, t = 5000 |
11 | Correct | 2 ms | 512 KB | [OK, No] n = 5000, m1 = 1495, m2 = 1506, t = 5000 |
12 | Correct | 2 ms | 384 KB | [OK, Yes] n = 5000, m1 = 974, m2 = 1026, t = 2501 |
13 | Correct | 2 ms | 384 KB | [OK, Yes] n = 5000, m1 = 1022, m2 = 978, t = 2501 |
14 | Correct | 2 ms | 384 KB | [OK, Yes] n = 5000, m1 = 1019, m2 = 981, t = 2501 |
15 | Correct | 2 ms | 512 KB | [OK, Yes] n = 5000, m1 = 1298, m2 = 1367, t = 2501 |
16 | Correct | 2 ms | 384 KB | [OK, No] n = 5000, m1 = 1301, m2 = 1360, t = 2501 |
17 | Correct | 2 ms | 512 KB | [OK, Yes] n = 5000, m1 = 1320, m2 = 1315, t = 2501 |
18 | Correct | 2 ms | 384 KB | [OK, No] n = 5000, m1 = 1195, m2 = 1135, t = 2501 |
19 | Correct | 2 ms | 384 KB | [OK, No] n = 5000, m1 = 1148, m2 = 1202, t = 2501 |
20 | Correct | 2 ms | 384 KB | [OK, No] n = 5000, m1 = 1147, m2 = 1179, t = 2501 |
21 | Correct | 2 ms | 384 KB | [OK, No] n = 5000, m1 = 1163, m2 = 1146, t = 2501 |
22 | Correct | 2 ms | 384 KB | [OK, No] n = 5000, m1 = 1145, m2 = 1184, t = 2501 |
23 | Correct | 2 ms | 384 KB | [OK, No] n = 5000, m1 = 1172, m2 = 1150, t = 2501 |
24 | Incorrect | 2 ms | 384 KB | Tank was blowed at position (1, 17) |
25 | Halted | 0 ms | 0 KB | - |