#include "minerals.h"
//#include "grader.cpp"
#include<bits/stdc++.h>
using namespace std;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
int n;
vector<int> v;
void dc(int a,int b,vector<int> &c){
//cout<<a<<' '<<b<<' '<<c.size()<<endl;
if(b-a==1){
v[a]=c[0];
return;
}
int t=0;
int m=(a+b)>>1;
for(int i=a;i<m;i++){
t=Query(i);
}
vector<int> c1,c2;
for(int i:c){
int t1=Query(i);
if(t1!=t){
Query(i);
c2.push_back(i);
}
else{
c1.push_back(i);
}
}
for(int i:c1){
Query(i);
}
for(int i=a;i<m;i++){
t=Query(i);
}
dc(a,m,c1);
dc(m,b,c2);
}
void Solve(int N) {
n=N;
v.resize(N*2+1,-1);
vector<int> c;
for(int i=N+1;i<=N*2;i++){
c.push_back(i);
}
dc(1,N+1,c);
for(int i=1;i<=n;i++){
Answer(i,v[i]);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
336 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
2 ms |
336 KB |
Output is correct |
3 |
Correct |
3 ms |
464 KB |
Output is correct |
4 |
Correct |
7 ms |
592 KB |
Output is correct |
5 |
Correct |
10 ms |
976 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
336 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
336 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
336 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
336 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
336 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
336 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
336 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |