# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
96853 |
2019-02-12T13:59:02 Z |
Kastanda |
ICC (CEOI16_icc) |
C++11 |
|
190 ms |
696 KB |
// I do it for the glory
#include<bits/stdc++.h>
#include "icc.h"
#define pb push_back
using namespace std;
int fe, se;
void GoForIt(vector < int > L, vector < int > R)
{
int cnt = 0;
while (L.size() > 1)
{
vector < int > L1, L2;
for (int i = 0; i < (int)L.size(); i++)
{
if (i < ((int)L.size() >> 1))
L1.pb(L[i]);
else
L2.pb(L[i]);
}
cnt ++;
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;
for (int i = 0; i < (int)R.size(); i++)
{
if (i < ((int)R.size() >> 1))
R1.pb(R[i]);
else
R2.pb(R[i]);
}
cnt ++;
bool w = query(L.size(), R1.size(), L.data(), R1.data());
if (w) R = R1;
else R = R2;
}
assert(cnt <= 13);
fe = L[0];
se = R[0];
return ;
}
void run(int N)
{
int P[N + 1];
set < int > S;
vector < int > A[N + 1];
for (int i = 1; i <= N; i++)
A[i].pb(i), P[i] = i, S.insert(i);
for (int q = 1; q <= N - 1; q ++)
{
vector < int > L, R;
for (int bit = 0; bit <= 7; bit ++)
{
L.clear(); R.clear();
int id = 0;
for (int i : S)
{
id ++;
bool w = (id & (1 << bit)) ? (1) : (0);
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 ?
if (query(L.size(), R.size(), L.data(), R.data()))
break;
}
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(); S.erase(pu);
}
return ;
}
// I'm feeling lucky this time ...
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
512 KB |
Ok! 96 queries used. |
2 |
Correct |
9 ms |
512 KB |
Ok! 106 queries used. |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
37 ms |
632 KB |
Ok! 530 queries used. |
2 |
Correct |
52 ms |
664 KB |
Ok! 691 queries used. |
3 |
Correct |
71 ms |
512 KB |
Ok! 692 queries used. |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
172 ms |
576 KB |
Ok! 1450 queries used. |
2 |
Correct |
190 ms |
632 KB |
Ok! 1703 queries used. |
3 |
Correct |
153 ms |
696 KB |
Ok! 1586 queries used. |
4 |
Correct |
144 ms |
564 KB |
Ok! 1546 queries used. |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
137 ms |
512 KB |
Ok! 1490 queries used. |
2 |
Correct |
140 ms |
564 KB |
Ok! 1527 queries used. |
3 |
Correct |
160 ms |
512 KB |
Ok! 1709 queries used. |
4 |
Correct |
134 ms |
512 KB |
Ok! 1483 queries used. |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
163 ms |
512 KB |
Ok! 1695 queries used. |
2 |
Correct |
141 ms |
512 KB |
Ok! 1710 queries used. |
3 |
Correct |
154 ms |
632 KB |
Ok! 1703 queries used. |
4 |
Correct |
160 ms |
512 KB |
Ok! 1661 queries used. |
5 |
Correct |
129 ms |
564 KB |
Ok! 1484 queries used. |
6 |
Correct |
143 ms |
568 KB |
Ok! 1572 queries used. |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
135 ms |
572 KB |
Too many queries! 1719 out of 1625 |
2 |
Halted |
0 ms |
0 KB |
- |