#include <bits/stdc++.h>
#include "icc.h"
using namespace std;
int i,j,k,q,sa,sb,qu,l,r,m,x,alo,balo;
int parent[101],mas[101],a[101],b[101];
int fix[101],go[101][101],rr[1000000];
int n;
void run(int n) {srand(time(NULL));
for (i=1;i<=n;i++)
parent[i]=i;
for (i=0;i<1000000;i++)rr[i]=rand()%2;
for (j=1;j<n;j++) {
for (i=1;i<=n;i++)
fix[i]=0;
for (i=1;i<=n;i++)
fix[parent[i]]=1;
k=0;
for (i=1;i<=n;i++)
if (fix[i])
mas[k++]=i;
while (true) {
for (i=0;i<k;i++)
fix[mas[i]]=rr[++q];
sa=sb=0;
for (i=0;i<=n;i++)
a[i]=b[i]=0;
for (i=1;i<=n;i++) {
if (fix[parent[i]])
a[sa++]=i;
else
b[sb++]=i;
}qu++;
if (query(sa,sb,a,b))
break;
}
l=1;r=sa;
while (l!=r) {
m=(l+r)/2;
for (i=0;i<=n;i++)
mas[i]=0;
for (i=l;i<=m;i++)
mas[i-l]=a[i-1];
if (query(m-l+1,sb,mas,b))
r=m;
else
l=m+1;
}
x=l;
l=1;r=sb;
while (l!=r) {
m=(l+r)/2;
for (i=0;i<=n;i++)
mas[i]=0;
for (i=l;i<=m;i++)
mas[i-l]=b[i-1];
if (query(sa,m-l+1,a,mas))
r=m;
else
l=m+1;
}
int solo=parent[a[x-1]];
for (i=1;i<=n;i++)
if (parent[i]==solo)
parent[i]=parent[b[l-1]];
setRoad(b[l-1],a[x-1]);
}
return;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
23 ms |
4472 KB |
Ok! 123 queries used. |
2 |
Correct |
22 ms |
4472 KB |
Ok! 112 queries used. |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
54 ms |
4472 KB |
Ok! 536 queries used. |
2 |
Correct |
78 ms |
4472 KB |
Ok! 838 queries used. |
3 |
Correct |
73 ms |
4504 KB |
Ok! 784 queries used. |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
167 ms |
4472 KB |
Ok! 1524 queries used. |
2 |
Correct |
241 ms |
4472 KB |
Ok! 2168 queries used. |
3 |
Correct |
179 ms |
4600 KB |
Ok! 1663 queries used. |
4 |
Correct |
184 ms |
4472 KB |
Ok! 1710 queries used. |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
188 ms |
4508 KB |
Ok! 1702 queries used. |
2 |
Correct |
184 ms |
4472 KB |
Ok! 1679 queries used. |
3 |
Correct |
210 ms |
4476 KB |
Ok! 1918 queries used. |
4 |
Correct |
172 ms |
4476 KB |
Ok! 1569 queries used. |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
208 ms |
4476 KB |
Too many queries! 1869 out of 1775 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
215 ms |
4472 KB |
Too many queries! 1897 out of 1625 |
2 |
Halted |
0 ms |
0 KB |
- |