제출 #950988

#제출 시각아이디문제언어결과실행 시간메모리
950988Darren0724Toxic Gene (NOI23_toxic)C++17
9.46 / 100
6 ms508 KiB
#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&times){ 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 timeMemoryGrader output
Fetching results...