This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include"minerals.h"
#include<iostream>
#include<vector>
using namespace std;
int flag[50000];
int query(int a){
flag[a]++;
flag[a]%=2;
return Query(a);
}
void solve(vector<int>m){
//cout<<m.size()<<"\n";
if(m.size()==2){
Answer(m[0],m[1]);
return;
}
int n=(int)m.size()/2;
for(int i:m)
if(query(i)>n/2)
query(i);
vector<int>m1,m2;
for(int i:m){
if(flag[i]){
query(i);
m1.push_back(i);
}else
m2.push_back(i);
}
solve(m1);
solve(m2);
}
void Solve(int N){
vector<int>m;
for(int i=1;i<=2*N;i++)
m.push_back(i);
solve(m);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |