Submission #298622

#TimeUsernameProblemLanguageResultExecution timeMemory
298622AmineTrabelsiCombo (IOI18_combo)C++14
10 / 100
104 ms556 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define v(x) vector<x> #define pb push_back #define mp make_pair const ll maxint=2e18; const ll minint =-2e18; /* (͡ ° ͜ʖ ͡ °): Hi, be careful of overflow. */ int press(string p); /* // comment out when submitting int press(string p){ cout<<p<<endl; int x; cin>>x; return x; } */ string let[4]={"A","B","X","Y"}; // the first character of S never reappears in it string guess_sequence(int N){ string res =""; int cnt = 0; int avoid = 0; for(int j=0;j<4;j++){ int x = press((res+let[j])); if(x == cnt+1){ res+=let[j]; cnt++; avoid = j; break; } } for(int i=1;i<N;i++){ for(int j=0;j<4;j++){ if(j != avoid); int x = press((res+let[j])); if(x == cnt+1){ res+=let[j]; cnt++; break; } } } return res; } // comment out when submitting /* int main(){ int n; cin>>n; cout<<guess_sequence(n)<<'\n'; return 0; } */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...