제출 #989657

#제출 시각아이디문제언어결과실행 시간메모리
989657Newtonabc콤보 (IOI18_combo)C++14
100 / 100
22 ms2024 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; vector<string> v; string guess_sequence(int N) { string s=""; if(press("AB")){ if(press("A")) s="A"; else s="B"; } else{ if(press("X")) s="X"; else s="Y"; } if(N==1) return s; if(s[0]!='A') v.push_back("A"); if(s[0]!='B') v.push_back("B"); if(s[0]!='X') v.push_back("X"); if(s[0]!='Y') v.push_back("Y"); for(int i=2;i<=N-1;i++){ string temp=s+v[2]+v[0]+s+v[2]+v[1]+s+v[2]+v[2]+s+v[1]; int ind=press(temp)-s.size(); s+=v[ind]; } if(press(s+"A"+s+"B")==N){ if(press(s+"A")==N) s+="A"; else s+="B"; } else{ if(press(s+"X")==N) s+="X"; else s+="Y"; } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...