#include "chameleon.h"
#include <bits/stdc++.h>
#define pb push_back
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
namespace {
vector<int> adj[1010];
}
void Solve(int N) {
vector<int> Q;
for (int i=1; i<=N; i++){
int l=i+1, h=2*N, k;
while (1){
k=0;
while (l<=h){
int m=(l+h)>>1;
Q.clear(), Q.pb(i);
for (int j=l; j<=m; j++) Q.pb(j);
if (Query(Q) <= m-l+1) k=m, h=m-1;
else l=m+1;
}
if (!k) break;
adj[i].pb(k), adj[k].pb(i);
l=k+1, h=2*N;
}
}
for (int i=1; i<=2*N; i++){
if (adj[i].size() == 1) continue;
Q.clear(), Q.pb(i), Q.pb(adj[i][0]), Q.pb(adj[i][1]);
if (Query(Q) == 1) {adj[i].pop_back(); continue;}
swap(adj[i][1], adj[i][2]);
Q.clear(), Q.pb(i), Q.pb(adj[i][0]), Q.pb(adj[i][1]);
if (Query(Q) == 1) {adj[i].pop_back(); continue;}
swap(adj[i][0], adj[i][2]);
adj[i].pop_back();
}
for (int i=1; i<=2*N; i++){
if (adj[i].empty()) continue;
int x;
if (adj[adj[i][0]][0] == i) x=adj[i][0];
else if (adj[adj[i][0]].size()>1 && adj[adj[i][0]][1] == i) x=adj[i][0];
else x=adj[i][1];
Answer(i, x);
adj[x].clear();
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
384 KB |
Wrong Answer [1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
Wrong Answer [1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
Wrong Answer [1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
384 KB |
Wrong Answer [1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
384 KB |
Wrong Answer [1] |
2 |
Halted |
0 ms |
0 KB |
- |