# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
950908 | qwe1rt1yuiop1 | Toxic Gene (NOI23_toxic) | C++17 | 9 ms | 604 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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');
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |