제출 #674580

#제출 시각아이디문제언어결과실행 시간메모리
674580Dulguun콤보 (IOI18_combo)C++11
100 / 100
39 ms600 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; string guess_sequence(int N) { string p; if(press("AB")){ if(press("A")) p="A"; else p="B"; } else { if(press("X")) p="X"; else p="Y"; } char c=p[0]; for(int i=1; i<N-1; i++){ if(c=='A'){ int a=press(p+"B"+p+"XY"+p+"XX"+p+"XB"); if(a==p.length()) p+='Y'; else if(a==p.length()+1) p+='B'; else if(a==p.length()+2) p+='X'; } else if(c=='B'){ int a=press(p+"A"+p+"XY"+p+"XX"+p+"XA"); if(a==p.length()) p+='Y'; else if(a==p.length()+1) p+='A'; else if(a==p.length()+2) p+='X'; } else if(c=='X'){ int a=press(p+"B"+p+"AY"+p+"AA"+p+"AB"); if(a==p.length()) p+='Y'; else if(a==p.length()+1) p+='B'; else if(a==p.length()+2) p+='A'; } else if(c=='Y'){ int a=press(p+"B"+p+"XA"+p+"XX"+p+"XB"); if(a==p.length()) p+='A'; else if(a==p.length()+1) p+='B'; else if(a==p.length()+2) p+='X'; } } if(p.length()==N-1){ if(c=='A'){ if(press(p+'X')==N) p+='X'; else if(press(p+'Y')==N) p+='Y'; else p+='B'; } else if(c=='B'){ if(press(p+'X')==N) p+='X'; else if(press(p+'Y')==N) p+='Y'; else p+='A'; } else if(c=='X'){ if(press(p+'A')==N) p+='A'; else if(press(p+'Y')==N) p+='Y'; else p+='B'; } else if(c=='Y'){ if(press(p+'X')==N) p+='X'; else if(press(p+'A')==N) p+='A'; else p+='B'; } } return p; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:19:9: 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(a==p.length()) p+='Y';
      |        ~^~~~~~~~~~~~
combo.cpp:20:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |     else if(a==p.length()+1) p+='B';
      |             ~^~~~~~~~~~~~~~
combo.cpp:21:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |     else if(a==p.length()+2) p+='X';
      |             ~^~~~~~~~~~~~~~
combo.cpp:24:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |     if(a==p.length()) p+='Y';
      |        ~^~~~~~~~~~~~
combo.cpp:25:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |     else if(a==p.length()+1) p+='A';
      |             ~^~~~~~~~~~~~~~
combo.cpp:26:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |     else if(a==p.length()+2) p+='X';
      |             ~^~~~~~~~~~~~~~
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(a==p.length()) p+='Y';
      |        ~^~~~~~~~~~~~
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(a==p.length()+1) p+='B';
      |             ~^~~~~~~~~~~~~~
combo.cpp:31:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |     else if(a==p.length()+2) p+='A';
      |             ~^~~~~~~~~~~~~~
combo.cpp:34:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |     if(a==p.length()) p+='A';
      |        ~^~~~~~~~~~~~
combo.cpp:35:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |     else if(a==p.length()+1) p+='B';
      |             ~^~~~~~~~~~~~~~
combo.cpp:36:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |     else if(a==p.length()+2) p+='X';
      |             ~^~~~~~~~~~~~~~
combo.cpp:39:16: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   39 |   if(p.length()==N-1){
      |      ~~~~~~~~~~^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...