# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
117635 |
2019-06-17T02:35:59 Z |
minhtung0404 |
ICC (CEOI16_icc) |
C++17 |
|
407 ms |
632 KB |
//https://oj.uz/problem/view/CEOI16_icc
#include<bits/stdc++.h>
#include "icc.h"
const int N = 105;
using namespace std;
int pset[N];
int find(int i) {return ((pset[i] == i) ? i : pset[i] = find(pset[i]));}
void dsu(int i, int j){
i = find(i); j = find(j);
if (i == j) return;
pset[i] = j;
}
bool query(vector <int> &a, vector <int> &b){
int A[N], B[N], siza = a.size(), sizb = b.size();
for (int i = 0; i < siza; i++) A[i] = a[i];
for (int i = 0; i < sizb; i++) B[i] = b[i];
return query(siza, sizb, A, B);
}
void find(vector <int>&a, vector <int>& b){
if (a.size() == 1) return;
int siz = (int)a.size() / 2;
vector <int> x; x.clear();
for (int i = 0; i < siz; i++) x.push_back(a[i]);
if (!query(x, b)){
x.clear();
for (int i = siz; i < (int)a.size(); i++) x.push_back(a[i]);
}
a.swap(x);
find(a, b);
}
void cal(vector <int>& a, vector <int>& b){
find(a, b); find(b, a);
setRoad(a[0], b[0]); dsu(a[0], b[0]);
}
void run(int n){
for (int i = 1; i <= n; i++) pset[i] = i;
while (1){
vector <int> A;
for (int i = 1; (1 << i) <= n; i++){
vector <int> a, b;
for (int j = 1; j <= n; j++){
if ((find(j) >> i)&1){
a.push_back(j);
}
else{
b.push_back(j);
}
}
if (query(a, b)){
cal(a, b); break;
}
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
163 ms |
512 KB |
Number of queries more than 3000 out of 1500 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
312 ms |
632 KB |
Number of queries more than 5000 out of 2500 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
407 ms |
512 KB |
Number of queries more than 4500 out of 2250 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
358 ms |
512 KB |
Number of queries more than 4000 out of 2000 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
322 ms |
632 KB |
Number of queries more than 3550 out of 1775 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
307 ms |
556 KB |
Number of queries more than 3250 out of 1625 |
2 |
Halted |
0 ms |
0 KB |
- |