Submission #1068298

#TimeUsernameProblemLanguageResultExecution timeMemory
1068298vjudge1COVID tests (CEOI24_covid)C++17
10 / 100
7015 ms344 KiB
#include<bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; double p; cin >> p; int t; cin >> t; char x; if(t == 1){ while(t--){ int pos[n]; for(int i = 0; i < n; i++){ cout << "Q" << " "; for(int j = 0; j < n; j++){ if(j != i){ cout << "0"; }else{ cout <<"1"; } } cout << endl<<flush; cin >> x; if(x == 'P'){ pos[i] = 1; }else{ pos[i] = 0; } } cout << "A" <<" "; for(int i = 0; i < n; i++){ cout<<pos[i]; } cout << endl<<flush; cin >> x; } }else{ while(t--){ int ans[n]; for(int i = 0; i < n; i++){ ans[i] = 0; } int t1 = 0; while(t1 == 0){ cout << "Q" <<" "; for(int i = 0; i < n; i++){ if(ans[i] == 1){ cout << "0"; }else{ cout << "1";} } cout << endl << flush; cin >> x; if(x == 'N'){ t1++; break; }else{ int l = 0; int r = n - 1; while(l < r){ int mid = (l + r)/2; cout << "Q" << " "; for(int i = 0; i < l; i++){ cout << "0"; } for(int i = l; i <= mid; i++){ if(ans[i] == 1){ cout <<"0"; }else{ cout <<"1";} } for(int i = mid + 1; i < n; i++){ cout <<"0"; } cout << endl << flush; cin >> x; if(x == 'P'){ r = mid; }else{ l = mid + 1;} } ans[l] = 1; } } cout << "A" <<" "; for(int i = 0; i < n; i++){ cout << ans[i]; } cout << endl << flush; cin >> x; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...