제출 #851216

#제출 시각아이디문제언어결과실행 시간메모리
851216Pajaraja콤보 (IOI18_combo)C++17
100 / 100
14 ms1912 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; char c[4]={'A','B','X','Y'}; string guess_sequence(int N) { int koji=0; string s1="XY",s2="BY"; if(press(s1)) koji+=2; if(press(s2)) koji+=1; string s=""; s+=c[koji]; vector<char> ch; for(int i=0;i<4;i++) if(i!=koji) ch.push_back(c[i]); if(N==1) return s; for(int i=2;i<N;i++) { string t=s+ch[0]+s+ch[1]+ch[0]+s+ch[1]+ch[1]+s+ch[1]+ch[2]; int x=press(t); if(x==i-1) s+=ch[2]; if(x==i+0) s+=ch[0]; if(x==i+1) s+=ch[1]; } string t1=s+ch[0],t2=s+ch[1],t3=s+ch[2]; if(press(t1)==N) return t1; if(press(t2)==N) return t2; return t3; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...