# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
283025 | 2020-08-25T08:46:31 Z | 최은수(#5745) | World of Tank (innopolis2018_final_E) | C++17 | 1 ms | 640 KB |
#include<iostream> #include<vector> #include<tuple> #include<algorithm> #define ep emplace #define eb emplace_back #define fi first #define se second #define all(x) (x).begin(),(x).end() using namespace std; typedef long long ll; typedef pair<int,int>pi; typedef pair<ll,ll>pl; const int inf=1e9+7; const ll INF=1e18; bool chk[1000010][2]; tuple<int,int,int>dp[5010][2][2]; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int n,m1,m2,t; cin>>n>>m1>>m2>>t; for(int i=0;i<m1;i++) { int x; cin>>x; chk[x][0]=1; } for(int i=0;i<m2;i++) { int x; cin>>x; chk[x][1]=1; } for(int i=0;i<=n;i++) for(int j=0;j<2;j++) for(int k=0;k<2;k++) dp[i][j][k]=tuple<int,int,int>(-1,-1,-1); dp[0][0][0]=tuple<int,int,int>(0,-1,-1); for(int i=0;i<n;i++) { for(int j=0;j<2;j++) { for(int k=0;k<2;k++) { if(!chk[i][j]&&get<0>(dp[i][j][k])==-1&&get<0>(dp[i][j^1][k])!=-1) dp[i][j][k]=tuple<int,int,int>(i,j^1,k); if(get<0>(dp[i][j][k])==-1) continue; if(chk[i+1][j]) { if(k==0&&i>=t) dp[i+1][j][1]=tuple<int,int,int>(i,j,k); } else dp[i+1][j][k]=tuple<int,int,int>(i,j,k); } } } tuple<int,int,int>ans(-1,-1,-1); for(int i=0;i<2;i++) for(int j=0;j<2;j++) if(get<0>(dp[n][i][j])!=-1) ans=tuple<int,int,int>(n,i,j); if(get<0>(ans)==-1) return cout<<"No"<<endl,0; vector<int>mv; vector<pi>sv; while(get<1>(ans)!=-1) { int i=get<0>(ans); int j=get<1>(ans); int k=get<2>(ans); ans=dp[i][j][k]; int nj=get<1>(ans); int nk=get<2>(ans); if(j!=nj&&nj!=-1) mv.eb(i); if(k==1&&nk==0) sv.eb(i-1,j); } sort(all(mv)); sort(all(sv)); cout<<"Yes"<<endl; cout<<mv.size()<<endl; for(int&t:mv) cout<<t<<' '; cout<<endl; cout<<sv.size()<<endl; for(pi&t:sv) cout<<t.fi<<' '<<t.se+1<<'\n'; return 0; }
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 384 KB | [OK, Yes] n = 20, m1 = 20, m2 = 0, t = 20 |
2 | Correct | 1 ms | 640 KB | [OK, Yes] n = 5000, m1 = 509, m2 = 491, t = 5000 |
3 | Correct | 1 ms | 640 KB | [OK, Yes] n = 5000, m1 = 764, m2 = 736, t = 5000 |
4 | Correct | 1 ms | 640 KB | [OK, Yes] n = 5000, m1 = 698, m2 = 802, t = 5000 |
5 | Correct | 1 ms | 640 KB | [OK, Yes] n = 5000, m1 = 720, m2 = 780, t = 5000 |
6 | Correct | 1 ms | 640 KB | [OK, Yes] n = 5000, m1 = 734, m2 = 766, t = 5000 |
7 | Correct | 1 ms | 640 KB | [OK, Yes] n = 5000, m1 = 997, m2 = 1003, t = 5000 |
8 | Correct | 1 ms | 640 KB | [OK, Yes] n = 5000, m1 = 1021, m2 = 979, t = 5000 |
9 | Correct | 1 ms | 640 KB | [OK, No] n = 5000, m1 = 1006, m2 = 995, t = 5000 |
10 | Correct | 1 ms | 640 KB | [OK, No] n = 5000, m1 = 1017, m2 = 984, t = 5000 |
11 | Correct | 1 ms | 640 KB | [OK, No] n = 5000, m1 = 1495, m2 = 1506, t = 5000 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 384 KB | [OK, Yes] n = 20, m1 = 20, m2 = 0, t = 20 |
2 | Correct | 1 ms | 640 KB | [OK, Yes] n = 5000, m1 = 509, m2 = 491, t = 5000 |
3 | Correct | 1 ms | 640 KB | [OK, Yes] n = 5000, m1 = 764, m2 = 736, t = 5000 |
4 | Correct | 1 ms | 640 KB | [OK, Yes] n = 5000, m1 = 698, m2 = 802, t = 5000 |
5 | Correct | 1 ms | 640 KB | [OK, Yes] n = 5000, m1 = 720, m2 = 780, t = 5000 |
6 | Correct | 1 ms | 640 KB | [OK, Yes] n = 5000, m1 = 734, m2 = 766, t = 5000 |
7 | Correct | 1 ms | 640 KB | [OK, Yes] n = 5000, m1 = 997, m2 = 1003, t = 5000 |
8 | Correct | 1 ms | 640 KB | [OK, Yes] n = 5000, m1 = 1021, m2 = 979, t = 5000 |
9 | Correct | 1 ms | 640 KB | [OK, No] n = 5000, m1 = 1006, m2 = 995, t = 5000 |
10 | Correct | 1 ms | 640 KB | [OK, No] n = 5000, m1 = 1017, m2 = 984, t = 5000 |
11 | Correct | 1 ms | 640 KB | [OK, No] n = 5000, m1 = 1495, m2 = 1506, t = 5000 |
12 | Correct | 1 ms | 640 KB | [OK, Yes] n = 5000, m1 = 974, m2 = 1026, t = 2501 |
13 | Correct | 1 ms | 640 KB | [OK, Yes] n = 5000, m1 = 1022, m2 = 978, t = 2501 |
14 | Correct | 1 ms | 640 KB | [OK, Yes] n = 5000, m1 = 1019, m2 = 981, t = 2501 |
15 | Correct | 1 ms | 640 KB | [OK, Yes] n = 5000, m1 = 1298, m2 = 1367, t = 2501 |
16 | Correct | 1 ms | 640 KB | [OK, No] n = 5000, m1 = 1301, m2 = 1360, t = 2501 |
17 | Correct | 1 ms | 640 KB | [OK, Yes] n = 5000, m1 = 1320, m2 = 1315, t = 2501 |
18 | Correct | 1 ms | 640 KB | [OK, No] n = 5000, m1 = 1195, m2 = 1135, t = 2501 |
19 | Correct | 1 ms | 640 KB | [OK, No] n = 5000, m1 = 1148, m2 = 1202, t = 2501 |
20 | Correct | 1 ms | 640 KB | [OK, No] n = 5000, m1 = 1147, m2 = 1179, t = 2501 |
21 | Correct | 1 ms | 640 KB | [OK, No] n = 5000, m1 = 1163, m2 = 1146, t = 2501 |
22 | Correct | 1 ms | 640 KB | [OK, No] n = 5000, m1 = 1145, m2 = 1184, t = 2501 |
23 | Correct | 1 ms | 640 KB | [OK, No] n = 5000, m1 = 1172, m2 = 1150, t = 2501 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 288 KB | [No solution found] n = 20, m1 = 12, m2 = 9, t = 3 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 384 KB | [OK, Yes] n = 20, m1 = 20, m2 = 0, t = 20 |
2 | Correct | 1 ms | 640 KB | [OK, Yes] n = 5000, m1 = 509, m2 = 491, t = 5000 |
3 | Correct | 1 ms | 640 KB | [OK, Yes] n = 5000, m1 = 764, m2 = 736, t = 5000 |
4 | Correct | 1 ms | 640 KB | [OK, Yes] n = 5000, m1 = 698, m2 = 802, t = 5000 |
5 | Correct | 1 ms | 640 KB | [OK, Yes] n = 5000, m1 = 720, m2 = 780, t = 5000 |
6 | Correct | 1 ms | 640 KB | [OK, Yes] n = 5000, m1 = 734, m2 = 766, t = 5000 |
7 | Correct | 1 ms | 640 KB | [OK, Yes] n = 5000, m1 = 997, m2 = 1003, t = 5000 |
8 | Correct | 1 ms | 640 KB | [OK, Yes] n = 5000, m1 = 1021, m2 = 979, t = 5000 |
9 | Correct | 1 ms | 640 KB | [OK, No] n = 5000, m1 = 1006, m2 = 995, t = 5000 |
10 | Correct | 1 ms | 640 KB | [OK, No] n = 5000, m1 = 1017, m2 = 984, t = 5000 |
11 | Correct | 1 ms | 640 KB | [OK, No] n = 5000, m1 = 1495, m2 = 1506, t = 5000 |
12 | Correct | 1 ms | 640 KB | [OK, Yes] n = 5000, m1 = 974, m2 = 1026, t = 2501 |
13 | Correct | 1 ms | 640 KB | [OK, Yes] n = 5000, m1 = 1022, m2 = 978, t = 2501 |
14 | Correct | 1 ms | 640 KB | [OK, Yes] n = 5000, m1 = 1019, m2 = 981, t = 2501 |
15 | Correct | 1 ms | 640 KB | [OK, Yes] n = 5000, m1 = 1298, m2 = 1367, t = 2501 |
16 | Correct | 1 ms | 640 KB | [OK, No] n = 5000, m1 = 1301, m2 = 1360, t = 2501 |
17 | Correct | 1 ms | 640 KB | [OK, Yes] n = 5000, m1 = 1320, m2 = 1315, t = 2501 |
18 | Correct | 1 ms | 640 KB | [OK, No] n = 5000, m1 = 1195, m2 = 1135, t = 2501 |
19 | Correct | 1 ms | 640 KB | [OK, No] n = 5000, m1 = 1148, m2 = 1202, t = 2501 |
20 | Correct | 1 ms | 640 KB | [OK, No] n = 5000, m1 = 1147, m2 = 1179, t = 2501 |
21 | Correct | 1 ms | 640 KB | [OK, No] n = 5000, m1 = 1163, m2 = 1146, t = 2501 |
22 | Correct | 1 ms | 640 KB | [OK, No] n = 5000, m1 = 1145, m2 = 1184, t = 2501 |
23 | Correct | 1 ms | 640 KB | [OK, No] n = 5000, m1 = 1172, m2 = 1150, t = 2501 |
24 | Incorrect | 1 ms | 384 KB | [No solution found] n = 500, m1 = 197, m2 = 53, t = 2 |
25 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 384 KB | [OK, Yes] n = 20, m1 = 20, m2 = 0, t = 20 |
2 | Correct | 1 ms | 640 KB | [OK, Yes] n = 5000, m1 = 509, m2 = 491, t = 5000 |
3 | Correct | 1 ms | 640 KB | [OK, Yes] n = 5000, m1 = 764, m2 = 736, t = 5000 |
4 | Correct | 1 ms | 640 KB | [OK, Yes] n = 5000, m1 = 698, m2 = 802, t = 5000 |
5 | Correct | 1 ms | 640 KB | [OK, Yes] n = 5000, m1 = 720, m2 = 780, t = 5000 |
6 | Correct | 1 ms | 640 KB | [OK, Yes] n = 5000, m1 = 734, m2 = 766, t = 5000 |
7 | Correct | 1 ms | 640 KB | [OK, Yes] n = 5000, m1 = 997, m2 = 1003, t = 5000 |
8 | Correct | 1 ms | 640 KB | [OK, Yes] n = 5000, m1 = 1021, m2 = 979, t = 5000 |
9 | Correct | 1 ms | 640 KB | [OK, No] n = 5000, m1 = 1006, m2 = 995, t = 5000 |
10 | Correct | 1 ms | 640 KB | [OK, No] n = 5000, m1 = 1017, m2 = 984, t = 5000 |
11 | Correct | 1 ms | 640 KB | [OK, No] n = 5000, m1 = 1495, m2 = 1506, t = 5000 |
12 | Correct | 1 ms | 640 KB | [OK, Yes] n = 5000, m1 = 974, m2 = 1026, t = 2501 |
13 | Correct | 1 ms | 640 KB | [OK, Yes] n = 5000, m1 = 1022, m2 = 978, t = 2501 |
14 | Correct | 1 ms | 640 KB | [OK, Yes] n = 5000, m1 = 1019, m2 = 981, t = 2501 |
15 | Correct | 1 ms | 640 KB | [OK, Yes] n = 5000, m1 = 1298, m2 = 1367, t = 2501 |
16 | Correct | 1 ms | 640 KB | [OK, No] n = 5000, m1 = 1301, m2 = 1360, t = 2501 |
17 | Correct | 1 ms | 640 KB | [OK, Yes] n = 5000, m1 = 1320, m2 = 1315, t = 2501 |
18 | Correct | 1 ms | 640 KB | [OK, No] n = 5000, m1 = 1195, m2 = 1135, t = 2501 |
19 | Correct | 1 ms | 640 KB | [OK, No] n = 5000, m1 = 1148, m2 = 1202, t = 2501 |
20 | Correct | 1 ms | 640 KB | [OK, No] n = 5000, m1 = 1147, m2 = 1179, t = 2501 |
21 | Correct | 1 ms | 640 KB | [OK, No] n = 5000, m1 = 1163, m2 = 1146, t = 2501 |
22 | Correct | 1 ms | 640 KB | [OK, No] n = 5000, m1 = 1145, m2 = 1184, t = 2501 |
23 | Correct | 1 ms | 640 KB | [OK, No] n = 5000, m1 = 1172, m2 = 1150, t = 2501 |
24 | Incorrect | 0 ms | 288 KB | [No solution found] n = 20, m1 = 12, m2 = 9, t = 3 |
25 | Halted | 0 ms | 0 KB | - |