Submission #1138822

#TimeUsernameProblemLanguageResultExecution timeMemory
1138822bestbestCombo (IOI18_combo)C++20
100 / 100
7 ms552 KiB
#include <bits/stdc++.h> using namespace std; #define en '\n' #define sp ' ' typedef long long ll; #define Linux ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define pii pair<int,int> #include "combo.h" string guess_sequence(int N) { string S = "",a; //cout << press("AB"); if(press("AB")>=1){ if(press("A")==1){ S+='A'; a="BXY"; //cout << "goa"; } else { S+='B'; a="AXY"; //cout << "gob"; } } else{ if(press("X")==1){ S+='X'; a="ABY"; //cout <<"gox"; } else { S+='Y'; a="ABX"; //cout << "goy"; } } int coins; string p=S,o=S; if(N==1)return S; for(int i=1;i+1<N;i++){ p=o+a[0]+a[0]+o+a[0]+a[1]+o+a[0]+a[2]+o+a[1]; //cout << p << sp << p.size() << sp; coins=press(p); if(coins==o.size()+2)o+=a[0]; else if(coins==o.size()+1)o+=a[1]; else if(coins==o.size())o+=a[2]; //else cout << "Bruh"; //cout<< sp << coins << sp << o.size() << sp << o << en; } if(press(o+a[0])==N){ o+=a[0]; } else if(press(o+a[1])==N){ o+=a[1]; } else o+=a[2]; //cout << o << en; return o; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...