#include "chameleon.h"
#include <vector>
#include <bitset>
#include <iostream>
using namespace std;
void Solve(int N) {
//cout << Query({1, 3, 4, 7}) << '\n';
//cout << Query({1, 2, 3, 4, 5, 6, 7, 8}) << '\n';
//cout << Query({3, 4, 5, 6, 7, 8}) << '\n';
//cout << Query({2, 3, 4, 5, 6, 8}) << '\n';
//cout << Query({2, 3, 4, 5, 6, 7}) << '\n';
//cout << Query({2, 3, 4, 5, 7, 8}) << '\n';
//cout << Query({2, 3, 4, 5, 7}) << '\n';
bitset<1001> found;
for(int i=1; i<=2*N; i++) {
vector<int> tests;
if(found[i])
continue;
for(int j=2*N; j>i; j--) {
if(found[j])
continue;
if(Query({i, j}) == 1)
tests.push_back(j);
if(tests.size() == 3)
break;
}
vector<int> check_same[3];
for(int j=1; j<=2*N; j++) {
if(i == j)
continue;
if(j != tests[0])
check_same[0].push_back(j);
if(j != tests[1])
check_same[1].push_back(j);
if(j != tests[2])
check_same[2].push_back(j);
}
int a = Query(check_same[0]);
int b = Query(check_same[1]);
int c = Query(check_same[2]);
//cout << a << ' ' << b << ' ' << c << '\t';
int same;
if(b == c)
same = tests[0];
if(a == c)
same = tests[1];
if(a == b)
same = tests[2];
//cout << i << ' ' << same << '\n';
found[i] = 1;
found[same] = 1;
Answer(i, same);
}
}
| # | 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... |