#include <bits/stdc++.h>
using namespace std;
#include "icc.h"
namespace local {
int n;
vector<int> V;
vector<vector<int>> groups;
void add_edge(int x, int y){
for (auto i: groups[y]) groups[x].push_back(i);
groups[y].clear();
vector<int> newv;
for (auto i: V) if (i != y) newv.push_back(i);
V.swap(newv);
setRoad(x, y);
}
void found_solve(vector<int> &g1, vector<int> &g2){
vector<int> tmp;
int l = 0, r = g1.size() - 1;
while (l < r){
int mid = (l + r) >> 1;
tmp.clear(); for (int i = 0; i <= mid; i++) tmp.push_back(g1[i]);
if (query(tmp.size(), g2.size(), &tmp[0], &g2[0])) r = mid;
else l = mid + 1;
}
vector<int> result = {g1[r]};
if (g2.size() > 1){
found_solve(g2, result);
return;
}
add_edge(result[0], g2[0]);
}
void normal_solve(vector<int> &v){
for (int b = 0; b < 7; b++){
vector<int> g1, g2;
for (int i = 0; i < (int)v.size(); i++){
if ((i >> b) & 1){
for (auto j: groups[v[i]]) g1.push_back(j);
}
else{
for (auto j: groups[v[i]]) g2.push_back(j);
}
}
if (query(g1.size(), g2.size(), &g1[0], &g2[0])){
found_solve(g1, g2);
return;
}
}
}
}
void run(int N){
local::n = N;
local::groups.resize(local::n + 1);
local::V.resize(local::n);
iota(local::V.begin(), local::V.end(), 1);
for (int i = 1; i <= local::n; i++) local::groups[i].push_back(i);
for (int i = 0; i < local::n - 1; i++){
local::normal_solve(local::V);
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
424 KB |
Wrong road! |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
468 KB |
Wrong road! |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
50 ms |
488 KB |
Not all edges were guessed! |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
50 ms |
484 KB |
Not all edges were guessed! |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
51 ms |
496 KB |
Not all edges were guessed! |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
51 ms |
468 KB |
Not all edges were guessed! |
2 |
Halted |
0 ms |
0 KB |
- |