#include "chameleon.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
namespace {
int n;
vector<pair<int, int>> adj[1010];
void erase(int x, int y){
auto iter1 = find(adj[x].begin(), adj[x].end(), pair<int, int>(y, 0));
auto iter2 = find(adj[y].begin(), adj[y].end(), pair<int, int>(x, 0));
assert(iter1!=adj[x].end());
assert(iter2!=adj[y].end());
iter1->second = 1;
iter2->second = 1;
}
} // namespace
void Solve(int N) {
n = N*2;
for (int i=1;i<=n;i++){
for (int j=i+1;j<=n;j++){
if (Query({i, j}) == 1){
adj[i].emplace_back(j, 0);
adj[j].emplace_back(i, 0);
}
}
}
for (int i=1;i<=n;i++) if (adj[i].size() > 1){
assert(adj[i].size()==3);
if (Query({adj[i][0].first, adj[i][1].first, i}) == 1) erase(i, adj[i][2].first);
else if (Query({adj[i][0].first, adj[i][2].first, i}) == 1) erase(i, adj[i][1].first);
else erase(i, adj[i][0].first);
}
for (int i=1;i<=n;i++){
int ans = -1;
for (auto &[x, y]:adj[i]) if (y==0) ans = x;
assert(ans != -1);
if (i < ans) Answer(i, ans);
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
336 KB |
Output is correct |
2 |
Correct |
0 ms |
336 KB |
Output is correct |
3 |
Incorrect |
15 ms |
208 KB |
Wrong Answer [3] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
336 KB |
Output is correct |
2 |
Correct |
0 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
0 ms |
336 KB |
Output is correct |
5 |
Correct |
0 ms |
336 KB |
Output is correct |
6 |
Correct |
0 ms |
336 KB |
Output is correct |
7 |
Correct |
1 ms |
336 KB |
Output is correct |
8 |
Correct |
0 ms |
336 KB |
Output is correct |
9 |
Correct |
0 ms |
336 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
336 KB |
Output is correct |
2 |
Correct |
0 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
0 ms |
336 KB |
Output is correct |
5 |
Correct |
0 ms |
336 KB |
Output is correct |
6 |
Correct |
0 ms |
336 KB |
Output is correct |
7 |
Correct |
1 ms |
336 KB |
Output is correct |
8 |
Correct |
0 ms |
336 KB |
Output is correct |
9 |
Correct |
0 ms |
336 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
1 ms |
336 KB |
Output is correct |
12 |
Correct |
1 ms |
336 KB |
Output is correct |
13 |
Correct |
1 ms |
336 KB |
Output is correct |
14 |
Correct |
1 ms |
336 KB |
Output is correct |
15 |
Correct |
1 ms |
336 KB |
Output is correct |
16 |
Correct |
1 ms |
336 KB |
Output is correct |
17 |
Correct |
1 ms |
336 KB |
Output is correct |
18 |
Correct |
1 ms |
336 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
336 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Incorrect |
15 ms |
340 KB |
Wrong Answer [3] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
336 KB |
Output is correct |
2 |
Correct |
0 ms |
336 KB |
Output is correct |
3 |
Incorrect |
15 ms |
208 KB |
Wrong Answer [3] |
4 |
Halted |
0 ms |
0 KB |
- |