제출 #914273

#제출 시각아이디문제언어결과실행 시간메모리
914273Aiperiii콤보 (IOI18_combo)C++14
100 / 100
12 ms1968 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int N) { string s="",t=""; if(press("AB")>=1){ if(press("A")==1){ s+='A'; t="BXY"; } else{ s+='B'; t="AXY"; } } else{ if(press("X")==1){ s+='X'; t="ABY"; } else{ s+='Y'; t="ABX"; } } for(int i=0;i<N-2;i++){ string x=s+t[0]+s+t[1]+t[0]+s+t[1]+t[1]+s+t[1]+t[2]; int pr=press(x); if(pr==s.size())s+=t[2]; else if(pr==s.size()+1)s+=t[0]; else s+=t[1]; } if(N>1){ string x=s+"A"+s+"B"; if(press(x)==s.size()+1){ x=s+"A"; if(press(x)==s.size()+1){ s+='A'; } else{ s+='B'; } } else{ x=s+"X"; if(press(x)==s.size()+1){ s+='X'; } else{ s+='Y'; } } } return s; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:29:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |         if(pr==s.size())s+=t[2];
      |            ~~^~~~~~~~~~
combo.cpp:30:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |         else if(pr==s.size()+1)s+=t[0];
      |                 ~~^~~~~~~~~~~~
combo.cpp:35:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |         if(press(x)==s.size()+1){
      |            ~~~~~~~~^~~~~~~~~~~~
combo.cpp:37:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |             if(press(x)==s.size()+1){
      |                ~~~~~~~~^~~~~~~~~~~~
combo.cpp:46:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |             if(press(x)==s.size()+1){
      |                ~~~~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...