#include "minerals.h"
#include <bits/stdc++.h>
using namespace std;
const int MAXN=86005;
int lo[MAXN],hi[MAXN];
vector<int> mid[MAXN];
int tengah(int x,int y){
return (x+y)/2;
}
void Solve(int N) {
for(int i=N+1;i<=2*N;i++){
lo[i]=1;
hi[i]=N;
mid[tengah(lo[i],hi[i])].push_back(i);
}
int sudah=0;
while(sudah<N){
for(int i=1;i<=N;i++){
Query(i);
while(!mid[i].empty()){
int now=mid[i].back();
mid[i].pop_back();
if(Query(now)==i){
hi[now]=i;
if(lo[now]<hi[now])mid[tengah(lo[now],hi[now])].push_back(now);
}
else{
lo[now]=i+1;
if(lo[now]<hi[now])mid[tengah(lo[now],hi[now])].push_back(now);
}
Query(now);
}
}
for(int i=1;i<=N;i++)Query(i);
}
for(int i=N+1;i<=2*N;i++)Answer(i,lo[i]);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
2296 KB |
Wrong Answer [2] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
10 ms |
2424 KB |
Wrong Answer [2] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
2296 KB |
Wrong Answer [2] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
2296 KB |
Wrong Answer [2] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
2296 KB |
Wrong Answer [2] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
2296 KB |
Wrong Answer [2] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
2296 KB |
Wrong Answer [2] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
2296 KB |
Wrong Answer [2] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
2296 KB |
Wrong Answer [2] |
2 |
Halted |
0 ms |
0 KB |
- |