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>
#include <ext/pb_ds/assoc_container.hpp>
#define x first
#define y second
#define pii pair<int,int>
#define pb push_back
#define eb emplace_back
#pragma GCC optimize("unroll-loops")
#define shandom_ruffle(a, b) shuffle(a, b, rng)
#define vi vector<int>
#define vl vector<ll>
#define popcnt __builtin_popcount
#define popcntll __builtin_popcountll
#define all(a) begin(a),end(a)
using namespace std;
using namespace __gnu_pbds;
using ll=long long;
using ull=unsigned long long;
using ld=long double;
int MOD=1000000007;
int MOD2=998244353;
vector<int> bases;
const ll LLINF=1ll<<60;
const char en='\n';
int laa=0;
map<int,int> im;
int query(int a)
{
int z=Query(a);
if (z==laa) return 1;
else
{
if (!im[a]) ++laa,im[a]=1;
else --laa,im[a]=0;
return 0;
}
}
void Solve(int N) {
vi v1,v2;
for (int i=1;i<=2*N;++i)
{
int u=query(i);
if (u==1) v2.pb(i),Query(i);
else v1.pb(i);
cout<<i<<' '<<u<<endl;
}
/*for (auto a: v1) cout<<a<<' ';
cout<<endl;
for (auto a: v2) cout<<a<<' ';
cout<<endl;*/
for (auto a: v1) query(a);
vi ind(N);
for (int b=14;b>=0;--b)
{
for (int i=0;i<N;++i) if (i&(1<<b)) query(v2[i]);
for (int i=0;i<N;++i)
{
if (query(v1[i])) ind[i]+=1<<b;
query(v1[i]);
}
for (int i=0;i<N;++i) if (i&(1<<b)) query(v2[i]);
}
/*for (auto a: ind) cout<<a<<' ';
cout<<endl;*/
for (int i=0;i<N;++i) Answer(v1[i],v2[ind[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... |