# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
115258 | 2019-06-06T12:19:51 Z | gs14004 | World of Tank (innopolis2018_final_E) | C++17 | 4 ms | 512 KB |
#include <bits/stdc++.h> using namespace std; using lint = long long; using pi = pair<int, int>; const int MAXN = 3000005; vector<int> v[2], ev; bool trk[MAXN][2]; int dp[MAXN][2]; int n, t; bool Has(int y, int x){ return binary_search(v[x].begin(), v[x].end(), y); } bool findCut(){ for(auto &i : v[0]){ ev.push_back(i); ev.push_back(i + 1); ev.push_back(i + 2); } for(auto &i : v[1]){ ev.push_back(i); ev.push_back(i + 1); ev.push_back(i + 2); } ev.push_back(0); sort(ev.begin(), ev.end()); ev.resize(unique(ev.begin(), ev.end()) - ev.begin()); dp[0][1] = -2e9; for(int i=1; i<ev.size(); i++){ for(int j=0; j<2; j++){ if(!Has(ev[i] - 1, j) && dp[i-1][j] < min(dp[i-1][j^1], t)){ dp[i][j] = min(dp[i-1][j^1], t) + 1; trk[i][j] = 1; } else{ dp[i][j] = dp[i-1][j] + 1; } if(Has(ev[i], j)){ dp[i][j] -= t; if(dp[i][j] <= 0) dp[i][j] = -2e9; } } } return max(dp[ev.size() - 1][0], dp[ev.size() - 1][1]) >= 0; } void trace(){ int pos = 0; if(dp[ev.size() - 1][0] < 0) pos = 1; vector<pi> boom; vector<int> trans; for(int i=ev.size() - 1; i; i--){ if(Has(ev[i], pos)){ int where = ev[i] - dp[i][pos]; where = max(where, 1); boom.emplace_back(where, pos + 1); dp[i][pos] += t; } if(trk[i][pos]){ pos ^= 1; trans.push_back(ev[i] - 1); } } assert(pos == 0); reverse(trans.begin(), trans.end()); reverse(boom.begin(), boom.end()); cout << trans.size() << endl; for(auto &i : trans) printf("%d ", i); cout << endl << boom.size() << endl; for(auto &i : boom) printf("%d %d\n", i.first, i.second); } int main(){ int t0, t1; scanf("%d %d %d %d",&n,&t0,&t1,&t); v[0].resize(t0); v[1].resize(t1); for(int i=0; i<2; i++){ for(auto &j : v[i]){ scanf("%d",&j); } } if(!findCut()){ puts("No"); return 0; } puts("Yes"); trace(); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | [OK, Yes] n = 20, m1 = 20, m2 = 0, t = 20 |
2 | Correct | 2 ms | 384 KB | [OK, Yes] n = 5000, m1 = 509, m2 = 491, t = 5000 |
3 | Correct | 3 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 | 3 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 | 3 ms | 384 KB | [OK, Yes] n = 5000, m1 = 1021, m2 = 979, t = 5000 |
9 | Correct | 3 ms | 384 KB | [OK, No] n = 5000, m1 = 1006, m2 = 995, t = 5000 |
10 | Correct | 3 ms | 384 KB | [OK, No] n = 5000, m1 = 1017, m2 = 984, t = 5000 |
11 | Correct | 3 ms | 512 KB | [OK, No] n = 5000, m1 = 1495, m2 = 1506, t = 5000 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | [OK, Yes] n = 20, m1 = 20, m2 = 0, t = 20 |
2 | Correct | 2 ms | 384 KB | [OK, Yes] n = 5000, m1 = 509, m2 = 491, t = 5000 |
3 | Correct | 3 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 | 3 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 | 3 ms | 384 KB | [OK, Yes] n = 5000, m1 = 1021, m2 = 979, t = 5000 |
9 | Correct | 3 ms | 384 KB | [OK, No] n = 5000, m1 = 1006, m2 = 995, t = 5000 |
10 | Correct | 3 ms | 384 KB | [OK, No] n = 5000, m1 = 1017, m2 = 984, t = 5000 |
11 | Correct | 3 ms | 512 KB | [OK, No] n = 5000, m1 = 1495, m2 = 1506, t = 5000 |
12 | Correct | 3 ms | 384 KB | [OK, Yes] n = 5000, m1 = 974, m2 = 1026, t = 2501 |
13 | Correct | 4 ms | 512 KB | [OK, Yes] n = 5000, m1 = 1022, m2 = 978, t = 2501 |
14 | Correct | 3 ms | 384 KB | [OK, Yes] n = 5000, m1 = 1019, m2 = 981, t = 2501 |
15 | Correct | 4 ms | 384 KB | [OK, Yes] n = 5000, m1 = 1298, m2 = 1367, t = 2501 |
16 | Correct | 3 ms | 384 KB | [OK, No] n = 5000, m1 = 1301, m2 = 1360, t = 2501 |
17 | Correct | 3 ms | 480 KB | [OK, Yes] n = 5000, m1 = 1320, m2 = 1315, t = 2501 |
18 | Correct | 3 ms | 384 KB | [OK, No] n = 5000, m1 = 1195, m2 = 1135, t = 2501 |
19 | Correct | 3 ms | 512 KB | [OK, No] n = 5000, m1 = 1148, m2 = 1202, t = 2501 |
20 | Correct | 3 ms | 384 KB | [OK, No] n = 5000, m1 = 1147, m2 = 1179, t = 2501 |
21 | Correct | 3 ms | 384 KB | [OK, No] n = 5000, m1 = 1163, m2 = 1146, t = 2501 |
22 | Correct | 3 ms | 384 KB | [OK, No] n = 5000, m1 = 1145, m2 = 1184, t = 2501 |
23 | Correct | 3 ms | 384 KB | [OK, No] n = 5000, m1 = 1172, m2 = 1150, t = 2501 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | [OK, Yes] n = 20, m1 = 12, m2 = 9, t = 3 |
2 | Incorrect | 2 ms | 256 KB | [No solution found] n = 10, m1 = 4, m2 = 2, t = 2 |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | [OK, Yes] n = 20, m1 = 20, m2 = 0, t = 20 |
2 | Correct | 2 ms | 384 KB | [OK, Yes] n = 5000, m1 = 509, m2 = 491, t = 5000 |
3 | Correct | 3 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 | 3 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 | 3 ms | 384 KB | [OK, Yes] n = 5000, m1 = 1021, m2 = 979, t = 5000 |
9 | Correct | 3 ms | 384 KB | [OK, No] n = 5000, m1 = 1006, m2 = 995, t = 5000 |
10 | Correct | 3 ms | 384 KB | [OK, No] n = 5000, m1 = 1017, m2 = 984, t = 5000 |
11 | Correct | 3 ms | 512 KB | [OK, No] n = 5000, m1 = 1495, m2 = 1506, t = 5000 |
12 | Correct | 3 ms | 384 KB | [OK, Yes] n = 5000, m1 = 974, m2 = 1026, t = 2501 |
13 | Correct | 4 ms | 512 KB | [OK, Yes] n = 5000, m1 = 1022, m2 = 978, t = 2501 |
14 | Correct | 3 ms | 384 KB | [OK, Yes] n = 5000, m1 = 1019, m2 = 981, t = 2501 |
15 | Correct | 4 ms | 384 KB | [OK, Yes] n = 5000, m1 = 1298, m2 = 1367, t = 2501 |
16 | Correct | 3 ms | 384 KB | [OK, No] n = 5000, m1 = 1301, m2 = 1360, t = 2501 |
17 | Correct | 3 ms | 480 KB | [OK, Yes] n = 5000, m1 = 1320, m2 = 1315, t = 2501 |
18 | Correct | 3 ms | 384 KB | [OK, No] n = 5000, m1 = 1195, m2 = 1135, t = 2501 |
19 | Correct | 3 ms | 512 KB | [OK, No] n = 5000, m1 = 1148, m2 = 1202, t = 2501 |
20 | Correct | 3 ms | 384 KB | [OK, No] n = 5000, m1 = 1147, m2 = 1179, t = 2501 |
21 | Correct | 3 ms | 384 KB | [OK, No] n = 5000, m1 = 1163, m2 = 1146, t = 2501 |
22 | Correct | 3 ms | 384 KB | [OK, No] n = 5000, m1 = 1145, m2 = 1184, t = 2501 |
23 | Correct | 3 ms | 384 KB | [OK, No] n = 5000, m1 = 1172, m2 = 1150, t = 2501 |
24 | Correct | 2 ms | 384 KB | [OK, Yes] n = 500, m1 = 197, m2 = 53, t = 2 |
25 | Correct | 3 ms | 384 KB | [OK, Yes] n = 500, m1 = 189, m2 = 61, t = 3 |
26 | Correct | 2 ms | 384 KB | [OK, No] n = 500, m1 = 66, m2 = 184, t = 4 |
27 | Incorrect | 2 ms | 384 KB | [No solution found] n = 500, m1 = 248, m2 = 252, t = 1 |
28 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | [OK, Yes] n = 20, m1 = 20, m2 = 0, t = 20 |
2 | Correct | 2 ms | 384 KB | [OK, Yes] n = 5000, m1 = 509, m2 = 491, t = 5000 |
3 | Correct | 3 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 | 3 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 | 3 ms | 384 KB | [OK, Yes] n = 5000, m1 = 1021, m2 = 979, t = 5000 |
9 | Correct | 3 ms | 384 KB | [OK, No] n = 5000, m1 = 1006, m2 = 995, t = 5000 |
10 | Correct | 3 ms | 384 KB | [OK, No] n = 5000, m1 = 1017, m2 = 984, t = 5000 |
11 | Correct | 3 ms | 512 KB | [OK, No] n = 5000, m1 = 1495, m2 = 1506, t = 5000 |
12 | Correct | 3 ms | 384 KB | [OK, Yes] n = 5000, m1 = 974, m2 = 1026, t = 2501 |
13 | Correct | 4 ms | 512 KB | [OK, Yes] n = 5000, m1 = 1022, m2 = 978, t = 2501 |
14 | Correct | 3 ms | 384 KB | [OK, Yes] n = 5000, m1 = 1019, m2 = 981, t = 2501 |
15 | Correct | 4 ms | 384 KB | [OK, Yes] n = 5000, m1 = 1298, m2 = 1367, t = 2501 |
16 | Correct | 3 ms | 384 KB | [OK, No] n = 5000, m1 = 1301, m2 = 1360, t = 2501 |
17 | Correct | 3 ms | 480 KB | [OK, Yes] n = 5000, m1 = 1320, m2 = 1315, t = 2501 |
18 | Correct | 3 ms | 384 KB | [OK, No] n = 5000, m1 = 1195, m2 = 1135, t = 2501 |
19 | Correct | 3 ms | 512 KB | [OK, No] n = 5000, m1 = 1148, m2 = 1202, t = 2501 |
20 | Correct | 3 ms | 384 KB | [OK, No] n = 5000, m1 = 1147, m2 = 1179, t = 2501 |
21 | Correct | 3 ms | 384 KB | [OK, No] n = 5000, m1 = 1163, m2 = 1146, t = 2501 |
22 | Correct | 3 ms | 384 KB | [OK, No] n = 5000, m1 = 1145, m2 = 1184, t = 2501 |
23 | Correct | 3 ms | 384 KB | [OK, No] n = 5000, m1 = 1172, m2 = 1150, t = 2501 |
24 | Correct | 2 ms | 384 KB | [OK, Yes] n = 20, m1 = 12, m2 = 9, t = 3 |
25 | Incorrect | 2 ms | 256 KB | [No solution found] n = 10, m1 = 4, m2 = 2, t = 2 |
26 | Halted | 0 ms | 0 KB | - |