제출 #526319

#제출 시각아이디문제언어결과실행 시간메모리
526319benson1029콤보 (IOI18_combo)C++14
100 / 100
36 ms680 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; vector<char> v = {'A', 'B', 'X', 'Y'}; char xth(int x, char ex) { for(char i:v) { if(i!=ex) { x--; if(x==0) return i; } } } std::string guess_sequence(int N) { string ans; if(press("AB")) { if(press("A")) ans = "A"; else ans = "B"; } else { if(press("X")) ans = "X"; else ans = "Y"; } for(int i=2; i<N; i++) { int tmp = press(ans + xth(1, ans[0]) + ans + xth(2, ans[0]) + xth(1, ans[0]) + ans + xth(2, ans[0]) + xth(2, ans[0]) + ans + xth(2, ans[0]) + xth(3, ans[0])); if(tmp==i) ans += xth(1, ans[0]); else if(tmp==i+1) ans += xth(2, ans[0]); else ans += xth(3, ans[0]); } if(N>1) { if(press(ans + xth(1, ans[0]))==N) ans += xth(1, ans[0]); else if(press(ans + xth(2, ans[0]))==N) ans += xth(2, ans[0]); else ans += xth(3, ans[0]); } return ans; }

컴파일 시 표준 에러 (stderr) 메시지

combo.cpp: In function 'char xth(int, char)':
combo.cpp:14:1: warning: control reaches end of non-void function [-Wreturn-type]
   14 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...