제출 #128904

#제출 시각아이디문제언어결과실행 시간메모리
128904kostia244Combo (IOI18_combo)C++14
5 / 100
1279 ms2168 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'}; int c = press("AB"); if(c) { c = press("A"); if(c) ban = 'A'; else ban = 'B'; } else { c = press("X"); if(c) ban = 'X'; else ban = 'Y'; } 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...