제출 #435217

#제출 시각아이디문제언어결과실행 시간메모리
435217Supersonic콤보 (IOI18_combo)C++14
0 / 100
4 ms268 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; char c; string m(string k){ string r; for(auto i:k){ if(i=='A')r+=c; else if(i==c)r+='A'; else r+=i; } return r; } std::string guess_sequence(int n) { int q=press("XA"); if(q==1){ q=press("X"); if(q==1)c='X'; else c='A'; } else{ q=press("B"); if(q==1)c='B'; else c='Y'; } string r="A";if(n==1)return m(r); while(r.length()<n-1){ q=press(m(r+"X"+r+"YX"+r+"YB"+r+"YY")); if(q==r.length())r+="B"; else if(q==r.length()+1)r+="X"; else r+="Y"; } if(press(m(r+"X"))==n)r+="X"; else if(press(m(r+"Y"))==n)r+="Y"; else r+="B"; return m(r); }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:27:19: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   27 |   while(r.length()<n-1){
      |         ~~~~~~~~~~^~~~
combo.cpp:29:9: 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(q==r.length())r+="B";
      |        ~^~~~~~~~~~~~
combo.cpp:30:14: 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(q==r.length()+1)r+="X";
      |             ~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...