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<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
const int LIM=5e4+7;
int czy[2*LIM], lst=-1;
bool pytaj(int x) {
czy[x]^=1;
int a=Query(x+1);
swap(a, lst);
return a!=lst;
}
void dc(vector<int>&X, vector<int>&Y) {
if(X.size()==1) {
Answer(X[0]+1, Y[0]+1);
return;
}
vector<int>AX, AY, BX, BY;
int mid=X.size()/2;
rep(i, mid) {
pytaj(X[i]);
AX.pb(X[i]);
}
for(int i=mid; i<X.size(); ++i) BX.pb(X[i]);
for(auto i : Y) {
if(czy[X[0]]) {
if(pytaj(i)) BY.pb(i);
else AY.pb(i);
} else {
if(pytaj(i)) AY.pb(i);
else BY.pb(i);
}
}
dc(AX, AY);
dc(BX, BY);
}
void Solve(int n) {
vector<int>X, Y;
rep(i, 2*n) {
if(pytaj(i)) X.pb(i);
else Y.pb(i);
if(X.size()==Y.size()) {
dc(X, Y);
X.clear();
Y.clear();
}
}
}
Compilation message (stderr)
minerals.cpp: In function 'void dc(std::vector<int>&, std::vector<int>&)':
minerals.cpp:29:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
29 | for(int i=mid; i<X.size(); ++i) BX.pb(X[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... |