# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
585631 |
2022-06-29T06:53:04 Z |
반딧불(#8385) |
ICC (CEOI16_icc) |
C++14 |
|
296 ms |
504 KB |
#include "icc.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int qa[105], qb[105];
int query(vector<int> a, vector<int> b){
if(a.empty() || b.empty()) return false;
for(auto A: a) for(auto B: b) if(A==B) exit(1);
for(int i=0; i<(int)a.size(); i++) qa[i] = a[i];
for(int i=0; i<(int)b.size(); i++) qb[i] = b[i];
return query(a.size(), b.size(), qa, qb);
}
struct unionFind{
int par[105];
void init(int _n){
for(int i=1; i<=_n; i++) par[i] = i;
}
int find(int x){
if(x==par[x]) return x;
return par[x] = find(par[x]);
}
void merge(int x, int y){
x = find(x), y = find(y);
par[x] = y;
}
} dsu;
int n;
bool arr[105][105];
void run(int N){
n = N;
dsu.init(n);
for(int cnt=1; cnt<n; cnt++){
int X=-1, Y=-1;
for(int j=1; j<=n; j++){
vector<int> v;
for(int x=j+1; x<=n; x++) if(dsu.find(j) != dsu.find(x)) v.push_back(x);
if(!query(vector<int>(1, j), v)) continue;
for(auto y: v){
if(!query(vector<int>(1, j), vector<int>(1, y))) continue;
X = j, Y = y;
break;
}
break;
}
assert(X!=-1);
setRoad(X, Y);
arr[X][Y] = arr[Y][X] = 1;
dsu.merge(X, Y);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
468 KB |
Ok! 210 queries used. |
2 |
Correct |
8 ms |
496 KB |
Ok! 204 queries used. |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
110 ms |
480 KB |
Ok! 2430 queries used. |
2 |
Correct |
106 ms |
488 KB |
Ok! 2380 queries used. |
3 |
Correct |
112 ms |
468 KB |
Ok! 2440 queries used. |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
296 ms |
504 KB |
Number of queries more than 4500 out of 2250 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
265 ms |
492 KB |
Number of queries more than 4000 out of 2000 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
242 ms |
500 KB |
Number of queries more than 3550 out of 1775 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
219 ms |
484 KB |
Number of queries more than 3250 out of 1625 |
2 |
Halted |
0 ms |
0 KB |
- |