# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
96838 |
2019-02-12T13:12:17 Z |
Kastanda |
ICC (CEOI16_icc) |
C++11 |
|
218 ms |
760 KB |
// I do it for the glory
#include<bits/stdc++.h>
#include "icc.h"
#define pb push_back
using namespace std;
mt19937 Rnd(time(0));
int fe, se;
bool Rand()
{
return (Rnd() & 1);
}
void GoForIt(vector < int > L, vector < int > R)
{
while (L.size() > 1)
{
vector < int > L1, L2;
shuffle(L.begin(), L.end(), Rnd);
for (int i = 0; i < (int)L.size(); i++)
{
if (i < ((int)L.size() >> 1))
L1.pb(L[i]);
else
L2.pb(L[i]);
}
assert(abs((int)L1.size() - (int)L2.size()) <= 1);
bool w = query(L1.size(), R.size(), L1.data(), R.data());
if (w) L = L1;
else L = L2;
}
while (R.size() > 1)
{
vector < int > R1, R2;
shuffle(R.begin(), R.end(), Rnd);
for (int i = 0; i < (int)R.size(); i++)
{
if (i < ((int)R.size() >> 1))
R1.pb(R[i]);
else
R2.pb(R[i]);
}
assert(abs((int)R1.size() - (int)R2.size()) <= 1);
bool w = query(L.size(), R1.size(), L.data(), R1.data());
if (w) R = R1;
else R = R2;
}
fe = L[0];
se = R[0];
return ;
}
void run(int N)
{
int P[N + 1];
vector < int > A[N + 1];
for (int i = 1; i <= N; i++)
A[i].pb(i), P[i] = i;
for (int q = 1; q <= N - 1; q ++)
{
bool done = 0;
vector < int > L, R;
while (!done)
{
L.clear(); R.clear();
for (int i = 1; i <= N; i++)
{
bool w = Rand();
for (int v : A[i])
{
if (w) L.pb(v);
else R.pb(v);
}
}
if (!L.size() || !R.size())
continue; // What are the odds of that ?
done = query(L.size(), R.size(), L.data(), R.data());
}
GoForIt(L, R);
setRoad(fe, se);
int v = fe, u = se, pu = P[u];
for (int w : A[pu])
P[w] = P[v], A[P[v]].pb(w);
A[pu].clear();
}
return ;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
512 KB |
Ok! 105 queries used. |
2 |
Correct |
9 ms |
512 KB |
Ok! 111 queries used. |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
53 ms |
512 KB |
Ok! 557 queries used. |
2 |
Correct |
73 ms |
632 KB |
Ok! 858 queries used. |
3 |
Correct |
79 ms |
632 KB |
Ok! 829 queries used. |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
147 ms |
632 KB |
Ok! 1546 queries used. |
2 |
Correct |
218 ms |
512 KB |
Ok! 2177 queries used. |
3 |
Correct |
143 ms |
632 KB |
Ok! 1652 queries used. |
4 |
Correct |
175 ms |
512 KB |
Ok! 1746 queries used. |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
140 ms |
572 KB |
Ok! 1671 queries used. |
2 |
Correct |
150 ms |
760 KB |
Ok! 1662 queries used. |
3 |
Correct |
200 ms |
636 KB |
Ok! 1895 queries used. |
4 |
Correct |
151 ms |
512 KB |
Ok! 1606 queries used. |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
191 ms |
564 KB |
Too many queries! 1905 out of 1775 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
201 ms |
604 KB |
Too many queries! 1922 out of 1625 |
2 |
Halted |
0 ms |
0 KB |
- |