#include "minerals.h"
#include<bits/stdc++.h>
using namespace std;
#define f first
#define s second
vector<int> a;
vector<pair<int,int>> vec;
void go(int l,int r,vector<int> &b){
if(l==r){
Query(a[l]);
assert((int)b.size()==1);
vec.push_back({a[l],b[0]});
return;
}
int mid=(l+r)/2;
int cur=0;
for(int i=l;i<=mid;i++){
cur=Query(a[i]);
}
vector<int> ls,rs;
for(auto v:b){
int x=Query(v);
if(x==cur){
ls.push_back(v);
}
else{
rs.push_back(v);
}
Query(v);
}
for(int i=l;i<=mid;i++){
Query(a[i]);
}
vector<int>().swap(b);
go(l,mid,ls);
go(mid+1,r,rs);
}
void Solve(int n){
vector<bool> ok(2*n+1);
int prv=0;
for(int i=1;i<=2*n;i++){
int x=Query(i);
if(x==prv+1){
ok[i]=true;
}
prv=x;
}
vector<int> b;
for(int i=1;i<=2*n;i++){
if(ok[i]) a.push_back(i);
else b.push_back(i);
}
for(int i=1;i<=2*n;i++){
Query(i);
}
go(0,n-1,b);
for(auto v:vec){
Answer(v.f,v.s);
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
2 ms |
600 KB |
Output is correct |
4 |
Correct |
4 ms |
856 KB |
Output is correct |
5 |
Correct |
8 ms |
1112 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
2 ms |
600 KB |
Output is correct |
8 |
Correct |
4 ms |
856 KB |
Output is correct |
9 |
Correct |
8 ms |
1112 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
6 ms |
856 KB |
Output is correct |
12 |
Correct |
9 ms |
1112 KB |
Output is correct |
13 |
Correct |
7 ms |
1272 KB |
Output is correct |
14 |
Correct |
9 ms |
1408 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
2 ms |
600 KB |
Output is correct |
8 |
Correct |
4 ms |
856 KB |
Output is correct |
9 |
Correct |
8 ms |
1112 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
6 ms |
856 KB |
Output is correct |
12 |
Correct |
9 ms |
1112 KB |
Output is correct |
13 |
Correct |
7 ms |
1272 KB |
Output is correct |
14 |
Correct |
9 ms |
1408 KB |
Output is correct |
15 |
Incorrect |
16 ms |
1980 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
2 ms |
600 KB |
Output is correct |
8 |
Correct |
4 ms |
856 KB |
Output is correct |
9 |
Correct |
8 ms |
1112 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
6 ms |
856 KB |
Output is correct |
12 |
Correct |
9 ms |
1112 KB |
Output is correct |
13 |
Correct |
7 ms |
1272 KB |
Output is correct |
14 |
Correct |
9 ms |
1408 KB |
Output is correct |
15 |
Incorrect |
16 ms |
1980 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
2 ms |
600 KB |
Output is correct |
8 |
Correct |
4 ms |
856 KB |
Output is correct |
9 |
Correct |
8 ms |
1112 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
6 ms |
856 KB |
Output is correct |
12 |
Correct |
9 ms |
1112 KB |
Output is correct |
13 |
Correct |
7 ms |
1272 KB |
Output is correct |
14 |
Correct |
9 ms |
1408 KB |
Output is correct |
15 |
Incorrect |
16 ms |
1980 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
2 ms |
600 KB |
Output is correct |
8 |
Correct |
4 ms |
856 KB |
Output is correct |
9 |
Correct |
8 ms |
1112 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
6 ms |
856 KB |
Output is correct |
12 |
Correct |
9 ms |
1112 KB |
Output is correct |
13 |
Correct |
7 ms |
1272 KB |
Output is correct |
14 |
Correct |
9 ms |
1408 KB |
Output is correct |
15 |
Incorrect |
16 ms |
1980 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
2 ms |
600 KB |
Output is correct |
8 |
Correct |
4 ms |
856 KB |
Output is correct |
9 |
Correct |
8 ms |
1112 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
6 ms |
856 KB |
Output is correct |
12 |
Correct |
9 ms |
1112 KB |
Output is correct |
13 |
Correct |
7 ms |
1272 KB |
Output is correct |
14 |
Correct |
9 ms |
1408 KB |
Output is correct |
15 |
Incorrect |
16 ms |
1980 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
2 ms |
600 KB |
Output is correct |
8 |
Correct |
4 ms |
856 KB |
Output is correct |
9 |
Correct |
8 ms |
1112 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
6 ms |
856 KB |
Output is correct |
12 |
Correct |
9 ms |
1112 KB |
Output is correct |
13 |
Correct |
7 ms |
1272 KB |
Output is correct |
14 |
Correct |
9 ms |
1408 KB |
Output is correct |
15 |
Incorrect |
16 ms |
1980 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |