# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
503196 | 2022-01-07T13:17:45 Z | leinad2 | Minerals (JOI19_minerals) | C++17 | 63 ms | 13620 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; int x=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())/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; } if(i%2==0)x=(v[i].size()+1)/2; else x=v[i].size()/2; for(auto p:v[i]) { if(Fi.size()==x)Se.push_back(p); else if(Se.size()+x==v[i].size())Fi.push_back(p); else { 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 | 0 ms | 200 KB | Output is correct |
3 | Correct | 0 ms | 328 KB | Output is correct |
4 | Correct | 1 ms | 328 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 460 KB | Output is correct |
2 | Correct | 3 ms | 780 KB | Output is correct |
3 | Correct | 4 ms | 1352 KB | Output is correct |
4 | Correct | 8 ms | 2408 KB | Output is correct |
5 | Correct | 23 ms | 4304 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 200 KB | Output is correct |
2 | Correct | 0 ms | 200 KB | Output is correct |
3 | Correct | 0 ms | 328 KB | Output is correct |
4 | Correct | 1 ms | 328 KB | Output is correct |
5 | Correct | 2 ms | 460 KB | Output is correct |
6 | Correct | 3 ms | 780 KB | Output is correct |
7 | Correct | 4 ms | 1352 KB | Output is correct |
8 | Correct | 8 ms | 2408 KB | Output is correct |
9 | Correct | 23 ms | 4304 KB | Output is correct |
10 | Correct | 1 ms | 584 KB | Output is correct |
11 | Correct | 10 ms | 3376 KB | Output is correct |
12 | Correct | 14 ms | 4360 KB | Output is correct |
13 | Correct | 15 ms | 4348 KB | Output is correct |
14 | Correct | 12 ms | 4400 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 200 KB | Output is correct |
2 | Correct | 0 ms | 200 KB | Output is correct |
3 | Correct | 0 ms | 328 KB | Output is correct |
4 | Correct | 1 ms | 328 KB | Output is correct |
5 | Correct | 2 ms | 460 KB | Output is correct |
6 | Correct | 3 ms | 780 KB | Output is correct |
7 | Correct | 4 ms | 1352 KB | Output is correct |
8 | Correct | 8 ms | 2408 KB | Output is correct |
9 | Correct | 23 ms | 4304 KB | Output is correct |
10 | Correct | 1 ms | 584 KB | Output is correct |
11 | Correct | 10 ms | 3376 KB | Output is correct |
12 | Correct | 14 ms | 4360 KB | Output is correct |
13 | Correct | 15 ms | 4348 KB | Output is correct |
14 | Correct | 12 ms | 4400 KB | Output is correct |
15 | Correct | 42 ms | 12788 KB | Output is correct |
16 | Correct | 45 ms | 12800 KB | Output is correct |
17 | Correct | 35 ms | 12832 KB | Output is correct |
18 | Correct | 35 ms | 12668 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 200 KB | Output is correct |
2 | Correct | 0 ms | 200 KB | Output is correct |
3 | Correct | 0 ms | 328 KB | Output is correct |
4 | Correct | 1 ms | 328 KB | Output is correct |
5 | Correct | 2 ms | 460 KB | Output is correct |
6 | Correct | 3 ms | 780 KB | Output is correct |
7 | Correct | 4 ms | 1352 KB | Output is correct |
8 | Correct | 8 ms | 2408 KB | Output is correct |
9 | Correct | 23 ms | 4304 KB | Output is correct |
10 | Correct | 1 ms | 584 KB | Output is correct |
11 | Correct | 10 ms | 3376 KB | Output is correct |
12 | Correct | 14 ms | 4360 KB | Output is correct |
13 | Correct | 15 ms | 4348 KB | Output is correct |
14 | Correct | 12 ms | 4400 KB | Output is correct |
15 | Correct | 42 ms | 12788 KB | Output is correct |
16 | Correct | 45 ms | 12800 KB | Output is correct |
17 | Correct | 35 ms | 12832 KB | Output is correct |
18 | Correct | 35 ms | 12668 KB | Output is correct |
19 | Correct | 49 ms | 12964 KB | Output is correct |
20 | Correct | 45 ms | 13060 KB | Output is correct |
21 | Correct | 54 ms | 13044 KB | Output is correct |
22 | Correct | 43 ms | 12820 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 200 KB | Output is correct |
2 | Correct | 0 ms | 200 KB | Output is correct |
3 | Correct | 0 ms | 328 KB | Output is correct |
4 | Correct | 1 ms | 328 KB | Output is correct |
5 | Correct | 2 ms | 460 KB | Output is correct |
6 | Correct | 3 ms | 780 KB | Output is correct |
7 | Correct | 4 ms | 1352 KB | Output is correct |
8 | Correct | 8 ms | 2408 KB | Output is correct |
9 | Correct | 23 ms | 4304 KB | Output is correct |
10 | Correct | 1 ms | 584 KB | Output is correct |
11 | Correct | 10 ms | 3376 KB | Output is correct |
12 | Correct | 14 ms | 4360 KB | Output is correct |
13 | Correct | 15 ms | 4348 KB | Output is correct |
14 | Correct | 12 ms | 4400 KB | Output is correct |
15 | Correct | 42 ms | 12788 KB | Output is correct |
16 | Correct | 45 ms | 12800 KB | Output is correct |
17 | Correct | 35 ms | 12832 KB | Output is correct |
18 | Correct | 35 ms | 12668 KB | Output is correct |
19 | Correct | 49 ms | 12964 KB | Output is correct |
20 | Correct | 45 ms | 13060 KB | Output is correct |
21 | Correct | 54 ms | 13044 KB | Output is correct |
22 | Correct | 43 ms | 12820 KB | Output is correct |
23 | Correct | 49 ms | 13208 KB | Output is correct |
24 | Correct | 52 ms | 13232 KB | Output is correct |
25 | Correct | 40 ms | 13200 KB | Output is correct |
26 | Correct | 49 ms | 13164 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 200 KB | Output is correct |
2 | Correct | 0 ms | 200 KB | Output is correct |
3 | Correct | 0 ms | 328 KB | Output is correct |
4 | Correct | 1 ms | 328 KB | Output is correct |
5 | Correct | 2 ms | 460 KB | Output is correct |
6 | Correct | 3 ms | 780 KB | Output is correct |
7 | Correct | 4 ms | 1352 KB | Output is correct |
8 | Correct | 8 ms | 2408 KB | Output is correct |
9 | Correct | 23 ms | 4304 KB | Output is correct |
10 | Correct | 1 ms | 584 KB | Output is correct |
11 | Correct | 10 ms | 3376 KB | Output is correct |
12 | Correct | 14 ms | 4360 KB | Output is correct |
13 | Correct | 15 ms | 4348 KB | Output is correct |
14 | Correct | 12 ms | 4400 KB | Output is correct |
15 | Correct | 42 ms | 12788 KB | Output is correct |
16 | Correct | 45 ms | 12800 KB | Output is correct |
17 | Correct | 35 ms | 12832 KB | Output is correct |
18 | Correct | 35 ms | 12668 KB | Output is correct |
19 | Correct | 49 ms | 12964 KB | Output is correct |
20 | Correct | 45 ms | 13060 KB | Output is correct |
21 | Correct | 54 ms | 13044 KB | Output is correct |
22 | Correct | 43 ms | 12820 KB | Output is correct |
23 | Correct | 49 ms | 13208 KB | Output is correct |
24 | Correct | 52 ms | 13232 KB | Output is correct |
25 | Correct | 40 ms | 13200 KB | Output is correct |
26 | Correct | 49 ms | 13164 KB | Output is correct |
27 | Correct | 58 ms | 13412 KB | Output is correct |
28 | Correct | 63 ms | 13336 KB | Output is correct |
29 | Correct | 48 ms | 13400 KB | Output is correct |
30 | Correct | 49 ms | 13268 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 200 KB | Output is correct |
2 | Correct | 0 ms | 200 KB | Output is correct |
3 | Correct | 0 ms | 328 KB | Output is correct |
4 | Correct | 1 ms | 328 KB | Output is correct |
5 | Correct | 2 ms | 460 KB | Output is correct |
6 | Correct | 3 ms | 780 KB | Output is correct |
7 | Correct | 4 ms | 1352 KB | Output is correct |
8 | Correct | 8 ms | 2408 KB | Output is correct |
9 | Correct | 23 ms | 4304 KB | Output is correct |
10 | Correct | 1 ms | 584 KB | Output is correct |
11 | Correct | 10 ms | 3376 KB | Output is correct |
12 | Correct | 14 ms | 4360 KB | Output is correct |
13 | Correct | 15 ms | 4348 KB | Output is correct |
14 | Correct | 12 ms | 4400 KB | Output is correct |
15 | Correct | 42 ms | 12788 KB | Output is correct |
16 | Correct | 45 ms | 12800 KB | Output is correct |
17 | Correct | 35 ms | 12832 KB | Output is correct |
18 | Correct | 35 ms | 12668 KB | Output is correct |
19 | Correct | 49 ms | 12964 KB | Output is correct |
20 | Correct | 45 ms | 13060 KB | Output is correct |
21 | Correct | 54 ms | 13044 KB | Output is correct |
22 | Correct | 43 ms | 12820 KB | Output is correct |
23 | Correct | 49 ms | 13208 KB | Output is correct |
24 | Correct | 52 ms | 13232 KB | Output is correct |
25 | Correct | 40 ms | 13200 KB | Output is correct |
26 | Correct | 49 ms | 13164 KB | Output is correct |
27 | Correct | 58 ms | 13412 KB | Output is correct |
28 | Correct | 63 ms | 13336 KB | Output is correct |
29 | Correct | 48 ms | 13400 KB | Output is correct |
30 | Correct | 49 ms | 13268 KB | Output is correct |
31 | Correct | 49 ms | 13608 KB | Output is correct |
32 | Correct | 62 ms | 13520 KB | Output is correct |
33 | Correct | 42 ms | 13620 KB | Output is correct |
34 | Correct | 42 ms | 13436 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 200 KB | Output is correct |
2 | Correct | 0 ms | 200 KB | Output is correct |
3 | Correct | 0 ms | 328 KB | Output is correct |
4 | Correct | 1 ms | 328 KB | Output is correct |
5 | Correct | 2 ms | 460 KB | Output is correct |
6 | Correct | 3 ms | 780 KB | Output is correct |
7 | Correct | 4 ms | 1352 KB | Output is correct |
8 | Correct | 8 ms | 2408 KB | Output is correct |
9 | Correct | 23 ms | 4304 KB | Output is correct |
10 | Correct | 1 ms | 584 KB | Output is correct |
11 | Correct | 10 ms | 3376 KB | Output is correct |
12 | Correct | 14 ms | 4360 KB | Output is correct |
13 | Correct | 15 ms | 4348 KB | Output is correct |
14 | Correct | 12 ms | 4400 KB | Output is correct |
15 | Correct | 42 ms | 12788 KB | Output is correct |
16 | Correct | 45 ms | 12800 KB | Output is correct |
17 | Correct | 35 ms | 12832 KB | Output is correct |
18 | Correct | 35 ms | 12668 KB | Output is correct |
19 | Correct | 49 ms | 12964 KB | Output is correct |
20 | Correct | 45 ms | 13060 KB | Output is correct |
21 | Correct | 54 ms | 13044 KB | Output is correct |
22 | Correct | 43 ms | 12820 KB | Output is correct |
23 | Correct | 49 ms | 13208 KB | Output is correct |
24 | Correct | 52 ms | 13232 KB | Output is correct |
25 | Correct | 40 ms | 13200 KB | Output is correct |
26 | Correct | 49 ms | 13164 KB | Output is correct |
27 | Correct | 58 ms | 13412 KB | Output is correct |
28 | Correct | 63 ms | 13336 KB | Output is correct |
29 | Correct | 48 ms | 13400 KB | Output is correct |
30 | Correct | 49 ms | 13268 KB | Output is correct |
31 | Correct | 49 ms | 13608 KB | Output is correct |
32 | Correct | 62 ms | 13520 KB | Output is correct |
33 | Correct | 42 ms | 13620 KB | Output is correct |
34 | Correct | 42 ms | 13436 KB | Output is correct |
35 | Incorrect | 47 ms | 9964 KB | Wrong Answer [2] |
36 | Halted | 0 ms | 0 KB | - |