제출 #1016523

#제출 시각아이디문제언어결과실행 시간메모리
1016523vjudge1Combo (IOI18_combo)C++17
100 / 100
23 ms2064 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int N) { string s = ""; string chars; // find first button int f = press("AB"); if(f>=1){ int ff = press("A"); if(ff==1) { chars = "BXY"; s = "A"; } else{ chars = "AXY"; s = "B"; } } else{ int ff = press("X"); if(ff==1){ chars = "ABY"; s = "X"; } else{ chars = "ABX"; s = "Y"; } } if(N==1) return s; // find 2nd to 2nd last button for (int i=2; i<N; i++){ string qry = s+chars[1] + s+chars[2]+chars[0] + s+chars[2]+chars[1] + s+chars[2]+chars[2]; int coins = press(qry); if(coins==i-1) s += chars[0]; else if(coins==i) s += chars[1]; else s += chars[2]; } // find last button int l = press(s+chars[0]); if(l==N) s += chars[0]; else{ int ll = press(s+chars[1]); if(ll==N) s += chars[1]; else s += chars[2]; } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...