# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
503210 | 2022-01-07T13:55:43 Z | leinad2 | Minerals (JOI19_minerals) | C++17 | 117 ms | 40000 KB |
#include "minerals.h" #include<bits/stdc++.h> using namespace std; vector<int>A; vector<vector<int> >v; vector<int>bit; 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; } int cnt=round((double)v[i].size()*0.31465); if(bit[i]==1) { for(int j=sz+v[i].size()-cnt;j<sz+v[i].size();j++)a=Query(A[j]); } else { for(int j=sz;j<sz+cnt;j++)a=Query(A[j]); } sz+=v[i].size(); } vector<vector<int> >V; vector<int>Bit; for(int i=0;i<v.size();i++) { vector<int>Fi, Se; if(v[i].size()==1) { V.push_back(v[i]); Bit.push_back(bit[i]); continue; } int cnt=round((double)v[i].size()*0.31465); for(auto p:v[i]) { if(bit[i]==1&&v[i].size()-cnt==Fi.size())Se.push_back(p); else if(bit[i]==1&&cnt==Se.size())Fi.push_back(p); else if(bit[i]==0&&cnt==Fi.size())Se.push_back(p); else if(bit[i]==0&&v[i].size()-cnt==Se.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); Bit.push_back(1); Bit.push_back(0); } v=V; bit=Bit; 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}; bit={1}; 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 | 1 ms | 328 KB | Output is correct |
4 | Correct | 1 ms | 328 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 968 KB | Output is correct |
2 | Correct | 5 ms | 1788 KB | Output is correct |
3 | Correct | 9 ms | 3352 KB | Output is correct |
4 | Correct | 18 ms | 6864 KB | Output is correct |
5 | Correct | 31 ms | 12704 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 | 1 ms | 328 KB | Output is correct |
4 | Correct | 1 ms | 328 KB | Output is correct |
5 | Correct | 3 ms | 968 KB | Output is correct |
6 | Correct | 5 ms | 1788 KB | Output is correct |
7 | Correct | 9 ms | 3352 KB | Output is correct |
8 | Correct | 18 ms | 6864 KB | Output is correct |
9 | Correct | 31 ms | 12704 KB | Output is correct |
10 | Correct | 2 ms | 968 KB | Output is correct |
11 | Correct | 21 ms | 8524 KB | Output is correct |
12 | Correct | 31 ms | 12752 KB | Output is correct |
13 | Correct | 28 ms | 12776 KB | Output is correct |
14 | Correct | 29 ms | 12628 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 | 1 ms | 328 KB | Output is correct |
4 | Correct | 1 ms | 328 KB | Output is correct |
5 | Correct | 3 ms | 968 KB | Output is correct |
6 | Correct | 5 ms | 1788 KB | Output is correct |
7 | Correct | 9 ms | 3352 KB | Output is correct |
8 | Correct | 18 ms | 6864 KB | Output is correct |
9 | Correct | 31 ms | 12704 KB | Output is correct |
10 | Correct | 2 ms | 968 KB | Output is correct |
11 | Correct | 21 ms | 8524 KB | Output is correct |
12 | Correct | 31 ms | 12752 KB | Output is correct |
13 | Correct | 28 ms | 12776 KB | Output is correct |
14 | Correct | 29 ms | 12628 KB | Output is correct |
15 | Correct | 91 ms | 35928 KB | Output is correct |
16 | Correct | 112 ms | 35932 KB | Output is correct |
17 | Correct | 86 ms | 35956 KB | Output is correct |
18 | Correct | 79 ms | 35888 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 | 1 ms | 328 KB | Output is correct |
4 | Correct | 1 ms | 328 KB | Output is correct |
5 | Correct | 3 ms | 968 KB | Output is correct |
6 | Correct | 5 ms | 1788 KB | Output is correct |
7 | Correct | 9 ms | 3352 KB | Output is correct |
8 | Correct | 18 ms | 6864 KB | Output is correct |
9 | Correct | 31 ms | 12704 KB | Output is correct |
10 | Correct | 2 ms | 968 KB | Output is correct |
11 | Correct | 21 ms | 8524 KB | Output is correct |
12 | Correct | 31 ms | 12752 KB | Output is correct |
13 | Correct | 28 ms | 12776 KB | Output is correct |
14 | Correct | 29 ms | 12628 KB | Output is correct |
15 | Correct | 91 ms | 35928 KB | Output is correct |
16 | Correct | 112 ms | 35932 KB | Output is correct |
17 | Correct | 86 ms | 35956 KB | Output is correct |
18 | Correct | 79 ms | 35888 KB | Output is correct |
19 | Correct | 96 ms | 36808 KB | Output is correct |
20 | Correct | 91 ms | 36692 KB | Output is correct |
21 | Correct | 81 ms | 36692 KB | Output is correct |
22 | Correct | 93 ms | 36604 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 | 1 ms | 328 KB | Output is correct |
4 | Correct | 1 ms | 328 KB | Output is correct |
5 | Correct | 3 ms | 968 KB | Output is correct |
6 | Correct | 5 ms | 1788 KB | Output is correct |
7 | Correct | 9 ms | 3352 KB | Output is correct |
8 | Correct | 18 ms | 6864 KB | Output is correct |
9 | Correct | 31 ms | 12704 KB | Output is correct |
10 | Correct | 2 ms | 968 KB | Output is correct |
11 | Correct | 21 ms | 8524 KB | Output is correct |
12 | Correct | 31 ms | 12752 KB | Output is correct |
13 | Correct | 28 ms | 12776 KB | Output is correct |
14 | Correct | 29 ms | 12628 KB | Output is correct |
15 | Correct | 91 ms | 35928 KB | Output is correct |
16 | Correct | 112 ms | 35932 KB | Output is correct |
17 | Correct | 86 ms | 35956 KB | Output is correct |
18 | Correct | 79 ms | 35888 KB | Output is correct |
19 | Correct | 96 ms | 36808 KB | Output is correct |
20 | Correct | 91 ms | 36692 KB | Output is correct |
21 | Correct | 81 ms | 36692 KB | Output is correct |
22 | Correct | 93 ms | 36604 KB | Output is correct |
23 | Correct | 101 ms | 37416 KB | Output is correct |
24 | Correct | 100 ms | 37484 KB | Output is correct |
25 | Correct | 89 ms | 37388 KB | Output is correct |
26 | Correct | 85 ms | 37292 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 | 1 ms | 328 KB | Output is correct |
4 | Correct | 1 ms | 328 KB | Output is correct |
5 | Correct | 3 ms | 968 KB | Output is correct |
6 | Correct | 5 ms | 1788 KB | Output is correct |
7 | Correct | 9 ms | 3352 KB | Output is correct |
8 | Correct | 18 ms | 6864 KB | Output is correct |
9 | Correct | 31 ms | 12704 KB | Output is correct |
10 | Correct | 2 ms | 968 KB | Output is correct |
11 | Correct | 21 ms | 8524 KB | Output is correct |
12 | Correct | 31 ms | 12752 KB | Output is correct |
13 | Correct | 28 ms | 12776 KB | Output is correct |
14 | Correct | 29 ms | 12628 KB | Output is correct |
15 | Correct | 91 ms | 35928 KB | Output is correct |
16 | Correct | 112 ms | 35932 KB | Output is correct |
17 | Correct | 86 ms | 35956 KB | Output is correct |
18 | Correct | 79 ms | 35888 KB | Output is correct |
19 | Correct | 96 ms | 36808 KB | Output is correct |
20 | Correct | 91 ms | 36692 KB | Output is correct |
21 | Correct | 81 ms | 36692 KB | Output is correct |
22 | Correct | 93 ms | 36604 KB | Output is correct |
23 | Correct | 101 ms | 37416 KB | Output is correct |
24 | Correct | 100 ms | 37484 KB | Output is correct |
25 | Correct | 89 ms | 37388 KB | Output is correct |
26 | Correct | 85 ms | 37292 KB | Output is correct |
27 | Correct | 102 ms | 38288 KB | Output is correct |
28 | Correct | 117 ms | 38228 KB | Output is correct |
29 | Correct | 92 ms | 38236 KB | Output is correct |
30 | Correct | 86 ms | 38116 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 | 1 ms | 328 KB | Output is correct |
4 | Correct | 1 ms | 328 KB | Output is correct |
5 | Correct | 3 ms | 968 KB | Output is correct |
6 | Correct | 5 ms | 1788 KB | Output is correct |
7 | Correct | 9 ms | 3352 KB | Output is correct |
8 | Correct | 18 ms | 6864 KB | Output is correct |
9 | Correct | 31 ms | 12704 KB | Output is correct |
10 | Correct | 2 ms | 968 KB | Output is correct |
11 | Correct | 21 ms | 8524 KB | Output is correct |
12 | Correct | 31 ms | 12752 KB | Output is correct |
13 | Correct | 28 ms | 12776 KB | Output is correct |
14 | Correct | 29 ms | 12628 KB | Output is correct |
15 | Correct | 91 ms | 35928 KB | Output is correct |
16 | Correct | 112 ms | 35932 KB | Output is correct |
17 | Correct | 86 ms | 35956 KB | Output is correct |
18 | Correct | 79 ms | 35888 KB | Output is correct |
19 | Correct | 96 ms | 36808 KB | Output is correct |
20 | Correct | 91 ms | 36692 KB | Output is correct |
21 | Correct | 81 ms | 36692 KB | Output is correct |
22 | Correct | 93 ms | 36604 KB | Output is correct |
23 | Correct | 101 ms | 37416 KB | Output is correct |
24 | Correct | 100 ms | 37484 KB | Output is correct |
25 | Correct | 89 ms | 37388 KB | Output is correct |
26 | Correct | 85 ms | 37292 KB | Output is correct |
27 | Correct | 102 ms | 38288 KB | Output is correct |
28 | Correct | 117 ms | 38228 KB | Output is correct |
29 | Correct | 92 ms | 38236 KB | Output is correct |
30 | Correct | 86 ms | 38116 KB | Output is correct |
31 | Correct | 105 ms | 39132 KB | Output is correct |
32 | Correct | 108 ms | 39120 KB | Output is correct |
33 | Correct | 89 ms | 39112 KB | Output is correct |
34 | Correct | 88 ms | 38964 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 | 1 ms | 328 KB | Output is correct |
4 | Correct | 1 ms | 328 KB | Output is correct |
5 | Correct | 3 ms | 968 KB | Output is correct |
6 | Correct | 5 ms | 1788 KB | Output is correct |
7 | Correct | 9 ms | 3352 KB | Output is correct |
8 | Correct | 18 ms | 6864 KB | Output is correct |
9 | Correct | 31 ms | 12704 KB | Output is correct |
10 | Correct | 2 ms | 968 KB | Output is correct |
11 | Correct | 21 ms | 8524 KB | Output is correct |
12 | Correct | 31 ms | 12752 KB | Output is correct |
13 | Correct | 28 ms | 12776 KB | Output is correct |
14 | Correct | 29 ms | 12628 KB | Output is correct |
15 | Correct | 91 ms | 35928 KB | Output is correct |
16 | Correct | 112 ms | 35932 KB | Output is correct |
17 | Correct | 86 ms | 35956 KB | Output is correct |
18 | Correct | 79 ms | 35888 KB | Output is correct |
19 | Correct | 96 ms | 36808 KB | Output is correct |
20 | Correct | 91 ms | 36692 KB | Output is correct |
21 | Correct | 81 ms | 36692 KB | Output is correct |
22 | Correct | 93 ms | 36604 KB | Output is correct |
23 | Correct | 101 ms | 37416 KB | Output is correct |
24 | Correct | 100 ms | 37484 KB | Output is correct |
25 | Correct | 89 ms | 37388 KB | Output is correct |
26 | Correct | 85 ms | 37292 KB | Output is correct |
27 | Correct | 102 ms | 38288 KB | Output is correct |
28 | Correct | 117 ms | 38228 KB | Output is correct |
29 | Correct | 92 ms | 38236 KB | Output is correct |
30 | Correct | 86 ms | 38116 KB | Output is correct |
31 | Correct | 105 ms | 39132 KB | Output is correct |
32 | Correct | 108 ms | 39120 KB | Output is correct |
33 | Correct | 89 ms | 39112 KB | Output is correct |
34 | Correct | 88 ms | 38964 KB | Output is correct |
35 | Correct | 112 ms | 39924 KB | Output is correct |
36 | Correct | 113 ms | 40000 KB | Output is correct |
37 | Correct | 91 ms | 39848 KB | Output is correct |
38 | Correct | 93 ms | 39772 KB | Output is correct |