제출 #630201

#제출 시각아이디문제언어결과실행 시간메모리
630201chubyxdxd콤보 (IOI18_combo)C++17
5 / 100
1 ms208 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; std::string guess_sequence(int N) { string S= ""; if(press("AB")){ if(press("A"))S+='A'; else S+='B'; } else{ if(press("X"))S+='X'; else S+='Y'; } string g="ABXY"; string aux; for(int i=0;i<g.size();i++){ if(S[0]!=g[i])aux+=g[i]; } //cout<<aux<<endl; int ans=1; for(int i=1;i<N-1;i++){ int pos=press(S+aux[0]+S+aux[1]+aux[1]+S+aux[1]+aux[2]+S+aux[1]+aux[0]); if(pos==ans+1)S+=aux[0]; if(pos==ans)S+=aux[2]; if(pos==ans+2)S+=aux[1]; ans=S.size(); } //cout<<S<<endl; if(press(S+aux[0])>S.size())S+=aux[0]; else{ //cout<<press(S+aux[1])<<endl; if(press(S+aux[1])>S.size())S+=aux[1]; else S+=aux[2]; } //cout<<S<<endl; return S; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:17:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |   for(int i=0;i<g.size();i++){
      |               ~^~~~~~~~~
combo.cpp:30:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |   if(press(S+aux[0])>S.size())S+=aux[0];
      |      ~~~~~~~~~~~~~~~^~~~~~~~~
combo.cpp:33:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |     if(press(S+aux[1])>S.size())S+=aux[1];
      |        ~~~~~~~~~~~~~~~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...