#include <bits/stdc++.h>
#include "chameleon.h"
using namespace std;
// void sep(int cur, vector<int> v[], vector<bool> &gender, vector<bool> &vis)
// {
// if(vis[cur]) return;
// vis[cur] = true;
// for(int i: v[cur])
// {
// if(vis[i]) continue;
// gender[i] = !gender[cur];
// sep(i, v, gender, vis);
// }
// }
// // 4
// // 0 1 0 1 0 1 0 1
// // 1 2 3 1 2 3 4 4
// // 2 3 4 5 6 7 8 1
// void Solve(int N)
// {
// const int MAX = 2 * N + 1;
// // vector<vector<int>> v(2 * N + 1, vector<int>(0));
// vector<int> v[MAX];
// int res[MAX][MAX];
// for(int i = 1; i <= 2 * N; i++)
// {
// for(int j = i + 1; j <= 2 * N; j++)
// {
// vector<int> p = {i, j};
// int w = Query(p);
// res[i][j] = w, res[j][i] = w;
// if(w == 1)
// {
// v[i].push_back(j);
// v[j].push_back(i);
// }
// }
// }
// vector<bool> vis(MAX), gender(MAX);
// for(int cur = 1; cur <= N * 2; cur++)
// {
// sep(cur, v, gender, vis);
// // string s = "MALE";
// // if(gender[cur]) s = "FEMALE";
// // cout << cur << ": " << s << "\n";
// }
// }
void Solve(int N)
{
vector<bool> answered(N * 2 + 1);
for(int i = 1; i <= N * 2; i++)
{
if(answered[i]) continue;
for(int j = i + 1; j <= N * 2; j++)
{
if(answered[j]) continue;
if(Query({i, j}) == 1) Answer(i, j);
}
}
}
/*
#include "chameleon.h"
#include <vector>
namespace {
int variable_example = 1;
} // namespace
void Solve(int N) {
std::vector<int> p(3);
p[0] = 1;
p[1] = 2;
p[2] = 3;
variable_example = Query(p);
for (int i = 0; i < N; ++i) {
Answer(i * 2 + 1, i * 2 + 2);
}
}
*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
384 KB |
Output is correct |
3 |
Incorrect |
29 ms |
512 KB |
Wrong Answer [3] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
384 KB |
Output is correct |
2 |
Incorrect |
4 ms |
384 KB |
Wrong Answer [6] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
384 KB |
Output is correct |
2 |
Incorrect |
4 ms |
384 KB |
Wrong Answer [6] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
384 KB |
Output is correct |
2 |
Incorrect |
5 ms |
384 KB |
Wrong Answer [6] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
384 KB |
Output is correct |
3 |
Incorrect |
29 ms |
512 KB |
Wrong Answer [3] |
4 |
Halted |
0 ms |
0 KB |
- |