제출 #712153

#제출 시각아이디문제언어결과실행 시간메모리
712153victor_gao콤보 (IOI18_combo)C++17
100 / 100
31 ms668 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; std::string guess_sequence(int N) { string str="",qry="AB"; vector<char>all; char C[4]={'A','B','X','Y'}; int l=press(qry); if (l>=1){ qry.pop_back(); l=press(qry); if (l==1) str="A"; else str="B"; } else { qry="X"; l=press(qry); if (l==1) str="X"; else str="Y"; } if (N==1) return str; for (int i=0;i<4;i++){ if (str[0]!=C[i]) all.push_back(C[i]); } int last=1; for (int i=2;i<N;i++){ qry=str+all[0]+all[0]+str+all[0]+all[1]+str+all[0]+all[2]+str+all[1]; l=press(qry); if (l==last) str.push_back(all[2]); else if (l==last+1) str.push_back(all[1]); else str.push_back(all[0]); last++; } qry=str+all[0]+str+all[1]; l=press(qry); if (l==last+1){ qry=str+all[0]; l=press(qry); if (l==last+1) str.push_back(all[0]); else str.push_back(all[1]); } else str.push_back(all[2]); return str; } //g++ -std=gnu++14 -Wall -O2 -static -o combo grader.cpp combo.cpp
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...