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 "grader.cpp"
#include <bits/stdc++.h>
using namespace std;
const int N = 43004;
vector<int> vec1, vec2;
void dc(vector<int> v1, vector<int> v2, int bit)
{
//~ cout << "v1 : ";
//~ for(int i : v1) cout << i << " ";
//~ cout << endl;
//~ cout << "v2 : ";
//~ for(int i : v2) cout << i << " ";
//~ cout << endl;
if(v1.size() == 1) {Answer(v1[0], v2[0]); return;}
vector<int> l1(v1.begin(), v1.begin()+v1.size()/2);
vector<int> l2(v1.begin()+v1.size()/2, v1.end());
vector<int> r1, r2;
int lst = 0;
for(int i=0; i<l1.size(); i++) lst = Query(l1[i]);
for(int i=0; i<v2.size(); i++)
{
int nw = Query(v2[i]);
if(bit)
{
if(nw == lst) r2.push_back(v2[i]);
else lst = nw, r1.push_back(v2[i]);
}
else
{
if(nw == lst) r1.push_back(v2[i]);
else lst = nw, r2.push_back(v2[i]);
}
}
if(l1.size()) dc(l1, r1, 1-bit);
if(l2.size()) dc(l2, r2, bit);
}
void Solve(int n)
{
int lst = 0;
for(int i=1; i<=2*n; i++)
{
if(lst == Query(i)) vec1.push_back(i);
else lst++, vec2.push_back(i);
}
dc(vec1, vec2, 1);
}
Compilation message (stderr)
minerals.cpp: In function 'void dc(std::vector<int>, std::vector<int>, int)':
minerals.cpp:20:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=0; i<l1.size(); i++) lst = Query(l1[i]);
~^~~~~~~~~~
minerals.cpp:21:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=0; i<v2.size(); i++)
~^~~~~~~~~~
# | 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... |