Submission #1184090

#TimeUsernameProblemLanguageResultExecution timeMemory
1184090inesfiCombo (IOI18_combo)C++20
100 / 100
8 ms484 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; //#define int long long char a,b,x,y; string rep; void premiercoup(){ int val=press("AB"); if (val==0){ val=press("X"); a='A'; b='B'; if (val==0){ y='Y'; x='X'; } else { y='X'; x='Y'; } } else { val=press("A"); b='X'; x='Y'; if (val==0){ y='B'; a='A'; } else { y='A'; a='B'; } } rep.push_back(y); } string guess_sequence(int N) { premiercoup(); if (N==1){ return rep; } for (int i=1;i<N-1;i++){ string q=rep+a+rep+b+a+rep+b+b+rep+b+x; //cout<<q<<endl; int val=press(q); if (val==(int)rep.size()){ rep.push_back(x); } else if (val==(int)rep.size()+1){ rep.push_back(a); } else { rep.push_back(b); } } int v=press(rep+a); if (v==N){ rep.push_back(a); } else { v=press(rep+b); if (v==N){ rep.push_back(b); } else { rep.push_back(x); } } /*cout<<a<<" "<<b<<" "<<x<<" "<<y<<endl; for (int i:rep){ cout<<i; } cout<<endl;*/ return rep; /*std::string p = ""; for (int i = 0; i < 4 * N; ++i) { p += 'A'; } int coins = press(p); std::string S = ""; for (int i = 0; i < N; ++i) { S += 'A'; } return S;*/ }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...