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;
#define fi first
#define se second
#define ll long long
#define dbg(v) cerr<<#v<<" = "<<v<<'\n'
#define vi vector<int>
#define vl vector <ll>
#define pii pair<int,int>
#define vii vector < pii >
#define mp make_pair
#define db long double
#define pb push_back
#define all(s) s.begin(),s.end()
template < class P , class Q > ostream& operator<<(ostream& stream, pair < P , Q > v){ stream << "(" << v.fi << ',' << v.se << ")"; return stream;}
template < class T > ostream& operator<<(ostream& stream, const vector<T> v){ stream << "[ "; for (int i=0; i<(int)v.size(); i++) stream << v[i] << " "; stream << "]"; return stream;}
template < class T > T smin(T &a,T b) {if (a > b) a = b;return a;}
template < class T > T smax(T &a,T b) {if (a < b) a = b;return a;}
const int N = 1e5 + 5;
int cnt;
void Go(vi a,vi b,int ok) {
random_shuffle(all(b));
if (a.size() == 1) {
Answer(a[0],b[0]);
} else {
int sz = a.size();
int m = sz / 2;
if (ok) {
for (int i = m;i < sz;++i)
cnt = Query(a[i]);
} else {
for (int i = 0;i < m;++i)
cnt = Query(a[i]);
}
vi x,y;
for (auto it : b) {
int cur = Query(it);
if (cnt != cur) {
y.pb(it);
} else {
x.pb(it);
}
cnt = cur;
}
Go(vi(a.begin(),a.begin() + m),x,1);
Go(vi(a.begin() + m,a.end()),y,0);
}
}
void Solve(int N) {
srand(time(0));
vi a,b;
for (int i = 1;i <= 2 * N;++i) {
int cur = Query(i);
if (cnt != cur) {
a.pb(i);
} else {
b.pb(i);
}
cnt = cur;
}
Go(a,b,1);
}
# | 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... |