#include "chameleon.h"
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define MOD (1000000000+7)
#define MOD1 (998244353)
#define pb push_back
#define all(x) x.begin(), x.end()
#define en cout << '\n'
#define ff first
#define ss second
#define pii pair<int,int>
#define vi vector<int>
const int N = 1e6+100, M = 5e3+10, K = 52, MX = 30;
namespace {
vector<bool> done;
void answer(int x, int y){
if(done[x] || done[y]) return;
done[x] = done[y] = 1;
cerr << x << ' ' << y << '\n';
Answer(x, y);
}
}
void Solve(int n) {
vector<vi> S(2*n+1);
done.resize(2*n+1);
vector<int> v, go(n*2+1);
for(int i = 1; i <= 2*n; ++i) v.pb(i);
for(int i = 1; i <= n*2; ++i){
for(int j = 1; j <= n*2; ++j){
if(i != j){
vi p; p.pb(i);
p.pb(j);
int x = Query(p);
if(x == 1){
S[i].pb(j);
}
}
}
if(S[i].size() == 1){
answer(i, S[i][0]);
}else{
vi A = {S[i][0], S[i][1], i};
vi B = {S[i][1], S[i][2], i};
vi C = {S[i][0], S[i][2], i};
int a = Query(A);
int b = Query(B);
int c = Query(C);
if(a == 1) go[i] = S[i][2];
else if(b == 1) go[i] = S[i][0];
else go[i] = S[i][1];
}
}
for(int i = 1; i <= 2*n; ++i){
for(int x: S[i]){
if(go[i] != x && go[x] != i){
answer(i, x);
}
}
}
}
# | 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... |