#include "toxic.h"
using namespace std;
#include <bits/stdc++.h>
vector<int> v;
string ans;
void ac(int x, char c)
{
assert(ans[x] == '0');
answer_type(x, c);
ans[x] = c;
}
int qry()
{
return query_sample(v);
}
int qry1(int l, int r)
{
v.clear();
for (int i = l; i <= r; ++i)
v.emplace_back(i);
return qry();
}
void determine_type(int n)
{
ans.assign(n + 1, '0');
vector<int> t;
t.emplace_back(0);
while (1)
{
int l = t.back() + 1, r = n;
if (qry1(l, r) == r - l + 1)
break;
while (l < r)
{
int mid = (l + r) >> 1;
if (qry1(l, mid) == mid - l + 1)
l = mid + 1;
else
r = mid;
}
t.emplace_back(l);
ac(l, 'T');
}
for (int i = 1; i <= n; ++i)
if (ans[i] == '0')
{
v.clear();
v.emplace_back(t.back());
v.emplace_back(i);
if (qry() == 1)
ac(i, 'S');
else
ac(i, 'R');
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Partially correct |
5 ms |
348 KB |
Partially correct |
3 |
Partially correct |
5 ms |
604 KB |
Partially correct |
4 |
Partially correct |
6 ms |
344 KB |
Partially correct |
5 |
Partially correct |
8 ms |
600 KB |
Partially correct |
6 |
Partially correct |
7 ms |
348 KB |
Partially correct |
7 |
Partially correct |
8 ms |
348 KB |
Partially correct |
8 |
Partially correct |
8 ms |
348 KB |
Partially correct |
9 |
Partially correct |
8 ms |
348 KB |
Partially correct |
10 |
Partially correct |
9 ms |
504 KB |
Partially correct |
11 |
Partially correct |
9 ms |
348 KB |
Partially correct |
12 |
Partially correct |
4 ms |
348 KB |
Partially correct |
13 |
Partially correct |
4 ms |
600 KB |
Partially correct |
14 |
Partially correct |
5 ms |
348 KB |
Partially correct |
15 |
Partially correct |
6 ms |
348 KB |
Partially correct |
16 |
Partially correct |
6 ms |
596 KB |
Partially correct |
17 |
Partially correct |
6 ms |
344 KB |
Partially correct |
18 |
Partially correct |
6 ms |
348 KB |
Partially correct |
19 |
Partially correct |
7 ms |
560 KB |
Partially correct |
20 |
Partially correct |
7 ms |
348 KB |
Partially correct |
21 |
Partially correct |
7 ms |
500 KB |
Partially correct |
22 |
Partially correct |
5 ms |
348 KB |
Partially correct |
23 |
Partially correct |
4 ms |
348 KB |
Partially correct |
24 |
Partially correct |
5 ms |
348 KB |
Partially correct |
25 |
Partially correct |
5 ms |
344 KB |
Partially correct |
26 |
Partially correct |
5 ms |
344 KB |
Partially correct |
27 |
Partially correct |
5 ms |
348 KB |
Partially correct |
28 |
Partially correct |
6 ms |
348 KB |
Partially correct |
29 |
Partially correct |
7 ms |
348 KB |
Partially correct |
30 |
Partially correct |
7 ms |
348 KB |
Partially correct |
31 |
Partially correct |
7 ms |
348 KB |
Partially correct |
32 |
Partially correct |
7 ms |
348 KB |
Partially correct |
33 |
Partially correct |
8 ms |
564 KB |
Partially correct |
34 |
Partially correct |
7 ms |
500 KB |
Partially correct |
35 |
Partially correct |
7 ms |
348 KB |
Partially correct |
36 |
Partially correct |
1 ms |
348 KB |
Partially correct |