# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
130962 |
2019-07-16T10:17:02 Z |
semiauto |
ICC (CEOI16_icc) |
C++14 |
|
212 ms |
632 KB |
#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];
int n;
void run(int n) {
srand(time(NULL));
for (i=1;i<=n;i++)
parent[i]=i;
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]]=rand()%2;
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;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
504 KB |
Ok! 114 queries used. |
2 |
Correct |
9 ms |
504 KB |
Ok! 107 queries used. |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
40 ms |
504 KB |
Ok! 542 queries used. |
2 |
Correct |
64 ms |
592 KB |
Ok! 865 queries used. |
3 |
Correct |
59 ms |
504 KB |
Ok! 798 queries used. |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
143 ms |
572 KB |
Ok! 1488 queries used. |
2 |
Correct |
212 ms |
508 KB |
Ok! 2140 queries used. |
3 |
Correct |
155 ms |
564 KB |
Ok! 1644 queries used. |
4 |
Correct |
161 ms |
504 KB |
Ok! 1666 queries used. |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
162 ms |
504 KB |
Ok! 1708 queries used. |
2 |
Correct |
167 ms |
632 KB |
Ok! 1692 queries used. |
3 |
Correct |
181 ms |
568 KB |
Ok! 1854 queries used. |
4 |
Correct |
148 ms |
600 KB |
Ok! 1543 queries used. |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
182 ms |
504 KB |
Too many queries! 1882 out of 1775 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
193 ms |
604 KB |
Too many queries! 1901 out of 1625 |
2 |
Halted |
0 ms |
0 KB |
- |