# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
250761 | 2020-07-19T05:20:02 Z | IsaacMoris | Minerals (JOI19_minerals) | C++14 | 29 ms | 5492 KB |
#include<iostream> #include <bits/stdc++.h> #include "minerals.h" #define ll long long #define ld long double #define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); using namespace std; int low[100009], high[100009]; vector<int> v[100009]; void Solve(int N) { vector<int> v1, v2; int last=0; for (int i = 1; i <= 2 * N; ++i) { int x=Query(i); if(x!=last) v1.push_back(i); else v2.push_back(i); last=x; } for (int i = 1; i <= 2 * N; ++i) Query(i); for(int i=0; i<N; i++) high[i]=N-1; int good=1; while(good) { good=0; for(int i=0; i<N; i++) if(low[i]!=high[i]) v[low[i]+high[i]>>1].push_back(i); for(int i=0; i<N; i++) { int x=Query(v1[i]); while(!v[i].empty()) { int id=v[i].back(); good=1; v[i].pop_back(); if(Query(v2[id])==x) high[id]=i; else low[id]=i+1; Query(v2[id]); } } for(int i=0; i<N; i++) Query(v1[i]); } for(int i=0; i<N; i++) Answer(v2[i], v1[low[i]]); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2688 KB | Output is correct |
2 | Correct | 2 ms | 2688 KB | Output is correct |
3 | Correct | 3 ms | 2688 KB | Output is correct |
4 | Correct | 2 ms | 2688 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 2816 KB | Output is correct |
2 | Correct | 4 ms | 2944 KB | Output is correct |
3 | Correct | 7 ms | 3072 KB | Output is correct |
4 | Correct | 14 ms | 3584 KB | Output is correct |
5 | Correct | 25 ms | 4472 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2688 KB | Output is correct |
2 | Correct | 2 ms | 2688 KB | Output is correct |
3 | Correct | 3 ms | 2688 KB | Output is correct |
4 | Correct | 2 ms | 2688 KB | Output is correct |
5 | Correct | 3 ms | 2816 KB | Output is correct |
6 | Correct | 4 ms | 2944 KB | Output is correct |
7 | Correct | 7 ms | 3072 KB | Output is correct |
8 | Correct | 14 ms | 3584 KB | Output is correct |
9 | Correct | 25 ms | 4472 KB | Output is correct |
10 | Correct | 3 ms | 2816 KB | Output is correct |
11 | Correct | 18 ms | 4096 KB | Output is correct |
12 | Correct | 27 ms | 4600 KB | Output is correct |
13 | Correct | 20 ms | 4608 KB | Output is correct |
14 | Correct | 23 ms | 4480 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2688 KB | Output is correct |
2 | Correct | 2 ms | 2688 KB | Output is correct |
3 | Correct | 3 ms | 2688 KB | Output is correct |
4 | Correct | 2 ms | 2688 KB | Output is correct |
5 | Correct | 3 ms | 2816 KB | Output is correct |
6 | Correct | 4 ms | 2944 KB | Output is correct |
7 | Correct | 7 ms | 3072 KB | Output is correct |
8 | Correct | 14 ms | 3584 KB | Output is correct |
9 | Correct | 25 ms | 4472 KB | Output is correct |
10 | Correct | 3 ms | 2816 KB | Output is correct |
11 | Correct | 18 ms | 4096 KB | Output is correct |
12 | Correct | 27 ms | 4600 KB | Output is correct |
13 | Correct | 20 ms | 4608 KB | Output is correct |
14 | Correct | 23 ms | 4480 KB | Output is correct |
15 | Incorrect | 29 ms | 5492 KB | Wrong Answer [2] |
16 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2688 KB | Output is correct |
2 | Correct | 2 ms | 2688 KB | Output is correct |
3 | Correct | 3 ms | 2688 KB | Output is correct |
4 | Correct | 2 ms | 2688 KB | Output is correct |
5 | Correct | 3 ms | 2816 KB | Output is correct |
6 | Correct | 4 ms | 2944 KB | Output is correct |
7 | Correct | 7 ms | 3072 KB | Output is correct |
8 | Correct | 14 ms | 3584 KB | Output is correct |
9 | Correct | 25 ms | 4472 KB | Output is correct |
10 | Correct | 3 ms | 2816 KB | Output is correct |
11 | Correct | 18 ms | 4096 KB | Output is correct |
12 | Correct | 27 ms | 4600 KB | Output is correct |
13 | Correct | 20 ms | 4608 KB | Output is correct |
14 | Correct | 23 ms | 4480 KB | Output is correct |
15 | Incorrect | 29 ms | 5492 KB | Wrong Answer [2] |
16 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2688 KB | Output is correct |
2 | Correct | 2 ms | 2688 KB | Output is correct |
3 | Correct | 3 ms | 2688 KB | Output is correct |
4 | Correct | 2 ms | 2688 KB | Output is correct |
5 | Correct | 3 ms | 2816 KB | Output is correct |
6 | Correct | 4 ms | 2944 KB | Output is correct |
7 | Correct | 7 ms | 3072 KB | Output is correct |
8 | Correct | 14 ms | 3584 KB | Output is correct |
9 | Correct | 25 ms | 4472 KB | Output is correct |
10 | Correct | 3 ms | 2816 KB | Output is correct |
11 | Correct | 18 ms | 4096 KB | Output is correct |
12 | Correct | 27 ms | 4600 KB | Output is correct |
13 | Correct | 20 ms | 4608 KB | Output is correct |
14 | Correct | 23 ms | 4480 KB | Output is correct |
15 | Incorrect | 29 ms | 5492 KB | Wrong Answer [2] |
16 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2688 KB | Output is correct |
2 | Correct | 2 ms | 2688 KB | Output is correct |
3 | Correct | 3 ms | 2688 KB | Output is correct |
4 | Correct | 2 ms | 2688 KB | Output is correct |
5 | Correct | 3 ms | 2816 KB | Output is correct |
6 | Correct | 4 ms | 2944 KB | Output is correct |
7 | Correct | 7 ms | 3072 KB | Output is correct |
8 | Correct | 14 ms | 3584 KB | Output is correct |
9 | Correct | 25 ms | 4472 KB | Output is correct |
10 | Correct | 3 ms | 2816 KB | Output is correct |
11 | Correct | 18 ms | 4096 KB | Output is correct |
12 | Correct | 27 ms | 4600 KB | Output is correct |
13 | Correct | 20 ms | 4608 KB | Output is correct |
14 | Correct | 23 ms | 4480 KB | Output is correct |
15 | Incorrect | 29 ms | 5492 KB | Wrong Answer [2] |
16 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2688 KB | Output is correct |
2 | Correct | 2 ms | 2688 KB | Output is correct |
3 | Correct | 3 ms | 2688 KB | Output is correct |
4 | Correct | 2 ms | 2688 KB | Output is correct |
5 | Correct | 3 ms | 2816 KB | Output is correct |
6 | Correct | 4 ms | 2944 KB | Output is correct |
7 | Correct | 7 ms | 3072 KB | Output is correct |
8 | Correct | 14 ms | 3584 KB | Output is correct |
9 | Correct | 25 ms | 4472 KB | Output is correct |
10 | Correct | 3 ms | 2816 KB | Output is correct |
11 | Correct | 18 ms | 4096 KB | Output is correct |
12 | Correct | 27 ms | 4600 KB | Output is correct |
13 | Correct | 20 ms | 4608 KB | Output is correct |
14 | Correct | 23 ms | 4480 KB | Output is correct |
15 | Incorrect | 29 ms | 5492 KB | Wrong Answer [2] |
16 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2688 KB | Output is correct |
2 | Correct | 2 ms | 2688 KB | Output is correct |
3 | Correct | 3 ms | 2688 KB | Output is correct |
4 | Correct | 2 ms | 2688 KB | Output is correct |
5 | Correct | 3 ms | 2816 KB | Output is correct |
6 | Correct | 4 ms | 2944 KB | Output is correct |
7 | Correct | 7 ms | 3072 KB | Output is correct |
8 | Correct | 14 ms | 3584 KB | Output is correct |
9 | Correct | 25 ms | 4472 KB | Output is correct |
10 | Correct | 3 ms | 2816 KB | Output is correct |
11 | Correct | 18 ms | 4096 KB | Output is correct |
12 | Correct | 27 ms | 4600 KB | Output is correct |
13 | Correct | 20 ms | 4608 KB | Output is correct |
14 | Correct | 23 ms | 4480 KB | Output is correct |
15 | Incorrect | 29 ms | 5492 KB | Wrong Answer [2] |
16 | Halted | 0 ms | 0 KB | - |