제출 #766889

#제출 시각아이디문제언어결과실행 시간메모리
766889canadavid1콤보 (IOI18_combo)C++14
100 / 100
32 ms608 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; #define pb push_back int press_internal(string p) { //cout << p << "\n"; return press(p); } string guess_sequence(int N) { mt19937 rng(12345); string answer = ""; string letters = ""; int a = (press_internal("XY")>0)*2 + (press_internal("BY")>0); char first_letter = "ABXY"[a]; for(auto i : "ABXY") if (i!=first_letter) letters.pb(i); answer.pb(first_letter); while(answer.size() < N-1) { string query = ""; query += answer; query.pb(letters[1]); for(int i = 0; i < 3; i++) { query += answer; query.pb(letters[2]); query.pb(letters[i]); } answer.pb(letters[press_internal(query)-answer.size()]); } if (N == 1) return answer; answer.pb(letters[0]); if(press_internal(answer)==N) return answer; answer.pop_back(); answer.pb(letters[1]); if(press_internal(answer)==N) return answer; answer.pop_back(); answer.pb(letters[2]); return answer; }

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

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