#include "chameleon.h"
#include <vector>
#include <bits/stdc++.h>
using namespace std;
namespace {
int variable_example = 1;
} // namespace
void Solve(int N) {
vector<vector<int>> adjlist(2 * N, vector<int>());
for (int i = 0; i < 2 * N; i++)
{
for (int j = 0; j < 2 * N; j++)
{
if (i != j)
{
vector<int> a = {i + 1, j + 1};
int b = Query(a);
if (b == 1)
{
adjlist[i].push_back(j);
}
}
}
}
for (int i = 0; i < 2 * N; i++)
{
cout << i << ": ";
for (int j : adjlist[i])
cout << j << ' ';
cout << '\n';
}
vector<bool> done(2 * N, false);
for (int i = 0; i < 2 * N; i++)
{
if (adjlist[i].size() == 1 && !done[i])
{
done[i] = true;
done[adjlist[i][0]] = true;
Answer(i + 1, adjlist[i][0] + 1);
}
else if (!done[i])
{
vector<int> a = {i + 1, adjlist[i][0] + 1, adjlist[i][1] + 1};
int b = Query(a);
if (b == 1)
{
adjlist[i].erase(adjlist[i].begin() + 2);
continue;
}
a = {i + 1, adjlist[i][0] + 1, adjlist[i][2] + 1};
b = Query(a);
if (b == 1)
{
adjlist[i].erase(adjlist[i].begin() + 1);
continue;
}
a = {i + 1, adjlist[i][2] + 1, adjlist[i][1] + 1};
b = Query(a);
if (b == 1)
{
adjlist[i].erase(adjlist[i].begin());
}
}
}
for (int i = 0; i < 2 * N; i++)
{
if (adjlist[i].size() != 1)
{
if (adjlist[adjlist[i][0]].size() != 1 && adjlist[adjlist[i][1]].size() != 1)
{
if ((adjlist[adjlist[i][0]][0] == i || adjlist[adjlist[i][0]][1] == i) && !done[i])
{
done[i] = true;
done[adjlist[i][0]] = true;
Answer(i + 1, adjlist[i][0] + 1);
}
else if (!done[i])
{
done[i] = true;
done[adjlist[i][1]] = true;
Answer(i + 1, adjlist[i][1] + 1);
}
}
}
}
}
Compilation message
chameleon.cpp:9:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
9 | int variable_example = 1;
| ^~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Line [name=secret] equals to "0: 3 ", doesn't correspond to pattern "[A-Za-z0-9]{1,100}" |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Line [name=secret] equals to "0: 3 ", doesn't correspond to pattern "[A-Za-z0-9]{1,100}" |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Line [name=secret] equals to "0: 3 ", doesn't correspond to pattern "[A-Za-z0-9]{1,100}" |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Line [name=secret] equals to "0: 3 ", doesn't correspond to pattern "[A-Za-z0-9]{1,100}" |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Line [name=secret] equals to "0: 3 ", doesn't correspond to pattern "[A-Za-z0-9]{1,100}" |
2 |
Halted |
0 ms |
0 KB |
- |