# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
503168 | 2022-01-07T12:15:45 Z | leinad2 | Minerals (JOI19_minerals) | C++17 | 48 ms | 13396 KB |
#include "minerals.h" #include<bits/stdc++.h> using namespace std; vector<int>A; vector<vector<int> >v; int a; void solve() { bool flag=true; for(int i=0;i<v.size();i++)if(v[i].size()>=2)flag=false; if(flag)return; int sz=0; for(int i=0;i<v.size();i++) { if(v[i].size()==1) { sz++; continue; } if(i%2==0) { for(int j=sz+(v[i].size()+1)/2;j<sz+v[i].size();j++)a=Query(A[j]); } else { for(int j=sz;j<sz+(v[i].size()+1)/2;j++)a=Query(A[j]); } sz+=v[i].size(); } vector<vector<int> >V; for(int i=0;i<v.size();i++) { vector<int>Fi, Se; if(v[i].size()==1) { V.push_back(v[i]); continue; } for(auto p:v[i]) { int b=Query(p); if(a!=b)Se.push_back(p); else Fi.push_back(p); a=b; } V.push_back(Fi); V.push_back(Se); } v=V; solve(); } void Solve(int N) { vector<int>A, B; for(int i=1;i<=2*N;i++) { int b=Query(i); if(a!=b)A.push_back(i); else B.push_back(i); a=b; } ::A=A; v={B}; solve(); vector<int>ans; for(int i=0;i<v.size();i++)if(v[i].size())ans.push_back(v[i][0]); for(int i=0;i<N;i++)Answer(A[i], ans[i]); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 200 KB | Output is correct |
2 | Correct | 1 ms | 200 KB | Output is correct |
3 | Correct | 0 ms | 328 KB | Output is correct |
4 | Correct | 0 ms | 328 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 536 KB | Output is correct |
2 | Correct | 2 ms | 840 KB | Output is correct |
3 | Correct | 4 ms | 1312 KB | Output is correct |
4 | Correct | 9 ms | 2376 KB | Output is correct |
5 | Correct | 15 ms | 4360 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 200 KB | Output is correct |
2 | Correct | 1 ms | 200 KB | Output is correct |
3 | Correct | 0 ms | 328 KB | Output is correct |
4 | Correct | 0 ms | 328 KB | Output is correct |
5 | Correct | 1 ms | 536 KB | Output is correct |
6 | Correct | 2 ms | 840 KB | Output is correct |
7 | Correct | 4 ms | 1312 KB | Output is correct |
8 | Correct | 9 ms | 2376 KB | Output is correct |
9 | Correct | 15 ms | 4360 KB | Output is correct |
10 | Correct | 1 ms | 584 KB | Output is correct |
11 | Correct | 10 ms | 3484 KB | Output is correct |
12 | Correct | 13 ms | 4392 KB | Output is correct |
13 | Correct | 12 ms | 4376 KB | Output is correct |
14 | Correct | 12 ms | 4352 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 200 KB | Output is correct |
2 | Correct | 1 ms | 200 KB | Output is correct |
3 | Correct | 0 ms | 328 KB | Output is correct |
4 | Correct | 0 ms | 328 KB | Output is correct |
5 | Correct | 1 ms | 536 KB | Output is correct |
6 | Correct | 2 ms | 840 KB | Output is correct |
7 | Correct | 4 ms | 1312 KB | Output is correct |
8 | Correct | 9 ms | 2376 KB | Output is correct |
9 | Correct | 15 ms | 4360 KB | Output is correct |
10 | Correct | 1 ms | 584 KB | Output is correct |
11 | Correct | 10 ms | 3484 KB | Output is correct |
12 | Correct | 13 ms | 4392 KB | Output is correct |
13 | Correct | 12 ms | 4376 KB | Output is correct |
14 | Correct | 12 ms | 4352 KB | Output is correct |
15 | Correct | 48 ms | 12784 KB | Output is correct |
16 | Correct | 45 ms | 12796 KB | Output is correct |
17 | Correct | 46 ms | 12856 KB | Output is correct |
18 | Correct | 39 ms | 12664 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 200 KB | Output is correct |
2 | Correct | 1 ms | 200 KB | Output is correct |
3 | Correct | 0 ms | 328 KB | Output is correct |
4 | Correct | 0 ms | 328 KB | Output is correct |
5 | Correct | 1 ms | 536 KB | Output is correct |
6 | Correct | 2 ms | 840 KB | Output is correct |
7 | Correct | 4 ms | 1312 KB | Output is correct |
8 | Correct | 9 ms | 2376 KB | Output is correct |
9 | Correct | 15 ms | 4360 KB | Output is correct |
10 | Correct | 1 ms | 584 KB | Output is correct |
11 | Correct | 10 ms | 3484 KB | Output is correct |
12 | Correct | 13 ms | 4392 KB | Output is correct |
13 | Correct | 12 ms | 4376 KB | Output is correct |
14 | Correct | 12 ms | 4352 KB | Output is correct |
15 | Correct | 48 ms | 12784 KB | Output is correct |
16 | Correct | 45 ms | 12796 KB | Output is correct |
17 | Correct | 46 ms | 12856 KB | Output is correct |
18 | Correct | 39 ms | 12664 KB | Output is correct |
19 | Correct | 41 ms | 12996 KB | Output is correct |
20 | Correct | 42 ms | 13008 KB | Output is correct |
21 | Correct | 35 ms | 12932 KB | Output is correct |
22 | Correct | 36 ms | 12872 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 200 KB | Output is correct |
2 | Correct | 1 ms | 200 KB | Output is correct |
3 | Correct | 0 ms | 328 KB | Output is correct |
4 | Correct | 0 ms | 328 KB | Output is correct |
5 | Correct | 1 ms | 536 KB | Output is correct |
6 | Correct | 2 ms | 840 KB | Output is correct |
7 | Correct | 4 ms | 1312 KB | Output is correct |
8 | Correct | 9 ms | 2376 KB | Output is correct |
9 | Correct | 15 ms | 4360 KB | Output is correct |
10 | Correct | 1 ms | 584 KB | Output is correct |
11 | Correct | 10 ms | 3484 KB | Output is correct |
12 | Correct | 13 ms | 4392 KB | Output is correct |
13 | Correct | 12 ms | 4376 KB | Output is correct |
14 | Correct | 12 ms | 4352 KB | Output is correct |
15 | Correct | 48 ms | 12784 KB | Output is correct |
16 | Correct | 45 ms | 12796 KB | Output is correct |
17 | Correct | 46 ms | 12856 KB | Output is correct |
18 | Correct | 39 ms | 12664 KB | Output is correct |
19 | Correct | 41 ms | 12996 KB | Output is correct |
20 | Correct | 42 ms | 13008 KB | Output is correct |
21 | Correct | 35 ms | 12932 KB | Output is correct |
22 | Correct | 36 ms | 12872 KB | Output is correct |
23 | Correct | 47 ms | 13396 KB | Output is correct |
24 | Correct | 46 ms | 13140 KB | Output is correct |
25 | Correct | 36 ms | 13224 KB | Output is correct |
26 | Correct | 40 ms | 13104 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 200 KB | Output is correct |
2 | Correct | 1 ms | 200 KB | Output is correct |
3 | Correct | 0 ms | 328 KB | Output is correct |
4 | Correct | 0 ms | 328 KB | Output is correct |
5 | Correct | 1 ms | 536 KB | Output is correct |
6 | Correct | 2 ms | 840 KB | Output is correct |
7 | Correct | 4 ms | 1312 KB | Output is correct |
8 | Correct | 9 ms | 2376 KB | Output is correct |
9 | Correct | 15 ms | 4360 KB | Output is correct |
10 | Correct | 1 ms | 584 KB | Output is correct |
11 | Correct | 10 ms | 3484 KB | Output is correct |
12 | Correct | 13 ms | 4392 KB | Output is correct |
13 | Correct | 12 ms | 4376 KB | Output is correct |
14 | Correct | 12 ms | 4352 KB | Output is correct |
15 | Correct | 48 ms | 12784 KB | Output is correct |
16 | Correct | 45 ms | 12796 KB | Output is correct |
17 | Correct | 46 ms | 12856 KB | Output is correct |
18 | Correct | 39 ms | 12664 KB | Output is correct |
19 | Correct | 41 ms | 12996 KB | Output is correct |
20 | Correct | 42 ms | 13008 KB | Output is correct |
21 | Correct | 35 ms | 12932 KB | Output is correct |
22 | Correct | 36 ms | 12872 KB | Output is correct |
23 | Correct | 47 ms | 13396 KB | Output is correct |
24 | Correct | 46 ms | 13140 KB | Output is correct |
25 | Correct | 36 ms | 13224 KB | Output is correct |
26 | Correct | 40 ms | 13104 KB | Output is correct |
27 | Incorrect | 35 ms | 7952 KB | Wrong Answer [2] |
28 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 200 KB | Output is correct |
2 | Correct | 1 ms | 200 KB | Output is correct |
3 | Correct | 0 ms | 328 KB | Output is correct |
4 | Correct | 0 ms | 328 KB | Output is correct |
5 | Correct | 1 ms | 536 KB | Output is correct |
6 | Correct | 2 ms | 840 KB | Output is correct |
7 | Correct | 4 ms | 1312 KB | Output is correct |
8 | Correct | 9 ms | 2376 KB | Output is correct |
9 | Correct | 15 ms | 4360 KB | Output is correct |
10 | Correct | 1 ms | 584 KB | Output is correct |
11 | Correct | 10 ms | 3484 KB | Output is correct |
12 | Correct | 13 ms | 4392 KB | Output is correct |
13 | Correct | 12 ms | 4376 KB | Output is correct |
14 | Correct | 12 ms | 4352 KB | Output is correct |
15 | Correct | 48 ms | 12784 KB | Output is correct |
16 | Correct | 45 ms | 12796 KB | Output is correct |
17 | Correct | 46 ms | 12856 KB | Output is correct |
18 | Correct | 39 ms | 12664 KB | Output is correct |
19 | Correct | 41 ms | 12996 KB | Output is correct |
20 | Correct | 42 ms | 13008 KB | Output is correct |
21 | Correct | 35 ms | 12932 KB | Output is correct |
22 | Correct | 36 ms | 12872 KB | Output is correct |
23 | Correct | 47 ms | 13396 KB | Output is correct |
24 | Correct | 46 ms | 13140 KB | Output is correct |
25 | Correct | 36 ms | 13224 KB | Output is correct |
26 | Correct | 40 ms | 13104 KB | Output is correct |
27 | Incorrect | 35 ms | 7952 KB | Wrong Answer [2] |
28 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 200 KB | Output is correct |
2 | Correct | 1 ms | 200 KB | Output is correct |
3 | Correct | 0 ms | 328 KB | Output is correct |
4 | Correct | 0 ms | 328 KB | Output is correct |
5 | Correct | 1 ms | 536 KB | Output is correct |
6 | Correct | 2 ms | 840 KB | Output is correct |
7 | Correct | 4 ms | 1312 KB | Output is correct |
8 | Correct | 9 ms | 2376 KB | Output is correct |
9 | Correct | 15 ms | 4360 KB | Output is correct |
10 | Correct | 1 ms | 584 KB | Output is correct |
11 | Correct | 10 ms | 3484 KB | Output is correct |
12 | Correct | 13 ms | 4392 KB | Output is correct |
13 | Correct | 12 ms | 4376 KB | Output is correct |
14 | Correct | 12 ms | 4352 KB | Output is correct |
15 | Correct | 48 ms | 12784 KB | Output is correct |
16 | Correct | 45 ms | 12796 KB | Output is correct |
17 | Correct | 46 ms | 12856 KB | Output is correct |
18 | Correct | 39 ms | 12664 KB | Output is correct |
19 | Correct | 41 ms | 12996 KB | Output is correct |
20 | Correct | 42 ms | 13008 KB | Output is correct |
21 | Correct | 35 ms | 12932 KB | Output is correct |
22 | Correct | 36 ms | 12872 KB | Output is correct |
23 | Correct | 47 ms | 13396 KB | Output is correct |
24 | Correct | 46 ms | 13140 KB | Output is correct |
25 | Correct | 36 ms | 13224 KB | Output is correct |
26 | Correct | 40 ms | 13104 KB | Output is correct |
27 | Incorrect | 35 ms | 7952 KB | Wrong Answer [2] |
28 | Halted | 0 ms | 0 KB | - |