Submission #128849

#TimeUsernameProblemLanguageResultExecution timeMemory
128849kostia244콤보 (IOI18_combo)C++14
97 / 100
201 ms1892 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; char ban = 'X'; string C; vector<char> canuse; char next(int p) { p--; string req = ""; req += C + canuse[0] + canuse[0]; req += C + canuse[0] + canuse[1]; req += C + canuse[0] + canuse[2]; req += C + canuse[1] + ban; int coins = press(req); if(coins == p) return canuse[2]; if(coins == p+1) return canuse[1]; return canuse[0]; } std::string guess_sequence(int N) { char a[] = {'A', 'B', 'Y', 'X'}; for(int i = 0; i < 3; i++) if(press(string(1, a[i]))) { ban = a[i]; break; } for(int i = 0; i < 4; i++) if(a[i] != ban) canuse.push_back(a[i]); C = ban; for(int i = 2; i < N; i++) C += next(i); if(N > 1) { if(press(C+canuse[0]) == N) C += canuse[0]; else if(press(C+canuse[1]) == N) C += canuse[1]; else C += canuse[2]; } return C; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...