제출 #1316782

#제출 시각아이디문제언어결과실행 시간메모리
131678212345678콤보 (IOI18_combo)C++17
91 / 100
8 ms592 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; std::string guess_sequence(int N) { string res; vector<char> op={'A', 'B', 'X', 'Y'}, new_op; char st; for (int i=0; i<4; i++) if (press(string(1, op[i]))==1) st=op[i], res=op[i]; if (N==1) return res; for (int i=0; i<4; i++) if (st!=op[i]) new_op.push_back(op[i]); for (int i=1; i<N-1; i++) { string s=(res+new_op[0])+(res+new_op[1]+new_op[0])+(res+new_op[1]+new_op[1])+(res+new_op[1]+new_op[2]); int p=press(s); if (p==res.size()) res+=new_op[2]; else if (p==res.size()+1) res+=new_op[0]; else res+=new_op[1]; } for (int i=0; i<3; i++) if (press(res+new_op[i])==N) return res+new_op[i]; }

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

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