제출 #732228

#제출 시각아이디문제언어결과실행 시간메모리
732228bane콤보 (IOI18_combo)C++17
100 / 100
39 ms688 KiB
#include<bits/stdc++.h> using namespace std; int press(std::string p); string guess_sequence(int N){ vector<string>frst = {"A", "B", "X", "Y"}; string ans = ""; if (press("AB")){ if (press("A")){ ans += "A"; frst.erase(frst.begin()); }else{ ans += "B"; frst.erase(frst.begin()+1); } }else{ if (press("X")){ ans += "X"; frst.erase(frst.begin()+2); }else{ ans += "Y"; frst.erase(frst.begin() + 3); } } for (int i = 0 ; i < N - 2; i++){ string ask = ans + frst[0] + frst[1] + ans + frst[0] + frst[0] + ans + frst[0] + frst[2] + ans + frst[1]; int res = press(ask) - (int)ans.size(); if (res == 2){ ans+=frst[0]; }else if (res == 1){ ans += frst[1]; }else{ ans += frst[2]; } } if (ans.size() != N)for (int j = 0 ; j < 2; j++){ if (press(ans + frst[j]) > (int)ans.size()){ ans += frst[j]; break; } } if ((int)ans.size() != N)ans+=frst[2]; return ans; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:36:17: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   36 |  if (ans.size() != N)for (int j = 0 ; j < 2; j++){
      |      ~~~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...