제출 #90815

#제출 시각아이디문제언어결과실행 시간메모리
90815tpoppo콤보 (IOI18_combo)C++14
5 / 100
2 ms200 KiB
#include<bits/stdc++.h> #include "combo.h" using namespace std; int n; string pref; vector<char> valid ={'A','B','X','Y'}; void get_next(){ string t1 = pref + valid[1]; for(int i=0;i<3;i++) t1 += pref + valid[2] + valid[i]; int r = max(0,(int)press(t1) - (int)pref.size()); pref += valid[r]; } void last(){ if(press(pref + valid[0] + pref + valid[1]) == pref.size()+1){ if(press(pref + valid[0]) == pref.size()+1){ pref += valid[0]; }else{ pref += valid[1]; } }else{ pref += valid[2]; } } string guess_sequence(int N) { n = N; if(press("AB")){ if(press("A")){ pref = "A"; valid.erase(valid.begin()); }else{ pref = "B"; valid.erase(valid.begin()+1); } }else{ if(press("X")){ pref = "X"; valid.erase(valid.begin()+2); }else{ pref = "Y"; valid.erase(valid.begin()+3); } } for(int i=1;i<n-1;i++) get_next(); last(); return pref; }

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

combo.cpp: In function 'void last()':
combo.cpp:19:49: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |     if(press(pref + valid[0] + pref + valid[1]) == pref.size()+1){
      |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
combo.cpp:20:35: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |         if(press(pref + valid[0]) == pref.size()+1){
      |            ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...