# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
137930 | zoooma13 | Minerals (JOI19_minerals) | C++14 | 39 ms | 3156 KiB |
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 "bits/stdc++.h"
#include "minerals.h"
using namespace std;
void go(vector<int> h1 ,vector<int> h2){
if(h1.size() == 1 && h2.size() == 1){
Answer(h1.front() ,h2.front());
return;
}
vector <int> nh1 = vector<int>{h1.begin() ,h1.begin()+h1.size()/2};
vector <int> nh2 = vector<int>{h1.begin()+h1.size()/2 ,h1.end()};
for(int i=0; i<nh1.size(); i++)
Query(nh1[i]);
vector <int> mh1 ,mh2;
for(int i=0; i<h2.size(); i++){
if(Query(h2[i]) == nh1.size())
mh1.push_back(h2[i]);
else
mh2.push_back(h2[i]);
Query(h2[i]);
}
for(int i=0; i<nh1.size(); i++)
Query(nh1[i]);
if(nh1.size()) go(nh1 ,mh1);
if(nh2.size()) go(nh2 ,mh2);
}
void Solve(int N) {
vector <int> h1 ,h2;
for(int lst=0,i=1; i<=2*N; i++){
if(Query(i) == lst)
h2.push_back(i);
else
h1.push_back(i) ,lst++;
}
for(int i=1; i<=2*N; i++)
Query(i);
go(h1 ,h2);
}
Compilation message (stderr)
# | 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... |