# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
580496 |
2022-06-21T10:48:04 Z |
andrei_boaca |
ICC (CEOI16_icc) |
C++14 |
|
331 ms |
612 KB |
#include <bits/stdc++.h>
#include "icc.h"
using namespace std;
int n;
vector<int> dsu[105];
int comp[105],a[105],b[105],asize,bsize;
void dsu_merge(int c1,int c2)
{
if(dsu[c1].size()<dsu[c2].size())
swap(c1,c2);
for(int i:dsu[c2])
{
comp[i]=c1;
dsu[c1].push_back(i);
}
dsu[c2].clear();
}
void run(int N)
{
n=N;
for(int i=1;i<=n;i++)
{
dsu[i].push_back(i);
comp[i]=i;
}
for(int z=1;z<n;z++)
{
int x=0,y=0;
for(int i=1;i<=n;i++)
{
asize=1;
a[0]=i;
bsize=0;
for(int j=1;j<=n;j++)
if(comp[j]!=comp[i])
b[bsize++]=j;
int ans=query(asize,bsize,a,b);
if(ans==1)
{
if(x==0)
x=i;
else
{
y=i;
break;
}
}
}
setRoad(x,y);
dsu_merge(comp[x],comp[y]);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
468 KB |
Ok! 210 queries used. |
2 |
Correct |
9 ms |
500 KB |
Ok! 204 queries used. |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
125 ms |
488 KB |
Ok! 2430 queries used. |
2 |
Correct |
115 ms |
588 KB |
Ok! 2380 queries used. |
3 |
Correct |
142 ms |
468 KB |
Ok! 2440 queries used. |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
331 ms |
612 KB |
Number of queries more than 4500 out of 2250 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
312 ms |
484 KB |
Number of queries more than 4000 out of 2000 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
271 ms |
484 KB |
Number of queries more than 3550 out of 1775 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
273 ms |
484 KB |
Number of queries more than 3250 out of 1625 |
2 |
Halted |
0 ms |
0 KB |
- |