# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
950988 | Darren0724 | Toxic Gene (NOI23_toxic) | C++17 | 6 ms | 508 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"
#include <bits/stdc++.h>
using namespace std;
void determine_type(int n){
vector<char> c(n+1,'0');
vector<int> a;
int t=0;
for(int i=1;i<=n;i++){
vector<int> v;
v.push_back(i);
int val=query_sample(v);
if(val==0){
c[i]='T';
t=i;
}
else{
a.push_back(i);
}
}
int sz=a.size();
for(int i=0;i<sz;i+=8){
vector<int> r(1,t);
int times=1;
for(int j=i;j<min(i+8,sz);j++){
for(int cnt=0;cnt<times;cnt++){
r.push_back(a[j]);
}
times<<=1;
}
int val=query_sample(r);
times=1;
for(int j=i;j<min(i+8,sz);j++){
if(val×){
c[a[j]]='S';
}
else{
c[a[j]]='R';
}
times<<=1;
}
}
for(int i=1;i<=n;i++){
answer_type(i,c[i]);
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |