제출 #89655

#제출 시각아이디문제언어결과실행 시간메모리
89655asifthegreat콤보 (IOI18_combo)C++14
97 / 100
61 ms576 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; std::string guess_sequence(int N) { int k = press("AB"); //debug(k); char first_letter = '['; if(k == 2){ first_letter = 'A'; } else if(k == 1){ if(press("B"))first_letter = 'B';//ABBXXYXYXYXYXYXYBBBBBBs else first_letter = 'A'; } else{ if(press("X"))first_letter = 'X'; else first_letter = 'Y'; } //debug(first_letter); string ss; if(first_letter != 'A' )ss.push_back('A'); if(first_letter != 'B' )ss.push_back('B'); if(first_letter != 'X' )ss.push_back('X'); if(first_letter != 'Y' )ss.push_back('Y'); //debug(ss); string ans; ans.push_back(first_letter); for(int i = 1; i < N;i++){ int x = ans.size(); if(x+2 > N)break; k = press(ans+ss[0]+ss[0]+ans+ss[0]+ss[1]+ans+ss[0]+ss[2]+ans+ss[1]); if(k == x+2){ ans.push_back(ss[0]); } else if(k == x+1)ans.push_back(ss[1]); else ans.push_back(ss[2]); } int x = ans.size(); k = press(ans+ss[1]); if(k > x)ans.push_back(ss[1]); else if(press(ans+ss[2]) == x+1)ans.push_back(ss[2]); else ans.push_back(ss[0]); while(ans.size() > N){ ans.pop_back(); } return ans; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:45:20: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   45 |   while(ans.size() > N){
      |         ~~~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...