제출 #424581

#제출 시각아이디문제언어결과실행 시간메모리
424581Trunkty콤보 (IOI18_combo)C++14
5 / 100
1 ms200 KiB
#include <iostream> #include "combo.h" using namespace std; int x; string guess_sequence(int N){ string s; x = press("AB"); if(x>=1){ x = press("AX"); if(x>=1){ s += "A"; } else{ s += "B"; } } else{ x = press("AX"); if(x>=1){ s += "X"; } else{ s += "Y"; } } if(s=="A"){ for(int i=2;i<N;i++){ x = press(s+"BB"+s+"BX"+s+"BY"+s+"X"); if(x==s.length()+2){ s += "B"; } else if(x==s.length()+1){ s += "X"; } else{ s += "Y"; } } x = press(s+"B"); if(x==N){ s += "B"; } else{ x = press(s+"X"); if(x==N){ s += "X"; } else{ s += "Y"; } } } else if(s=="B"){ for(int i=2;i<N;i++){ x = press(s+"AA"+s+"AX"+s+"AY"+s+"X"); if(x==s.length()+2){ s += "A"; } else if(x==s.length()+1){ s += "X"; } else{ s += "Y"; } } x = press(s+"A"); if(x==N){ s += "A"; } else{ x = press(s+"X"); if(x==N){ s += "X"; } else{ s += "Y"; } } } else if(s=="X"){ for(int i=2;i<N;i++){ x = press(s+"AA"+s+"AB"+s+"AY"+s+"B"); if(x==s.length()+2){ s += "A"; } else if(x==s.length()+1){ s += "B"; } else{ s += "Y"; } } x = press(s+"A"); if(x==N){ s += "A"; } else{ x = press(s+"B"); if(x==N){ s += "B"; } else{ s += "Y"; } } } else{ for(int i=2;i<N;i++){ x = press(s+"AA"+s+"AB"+s+"AX"+s+"B"); if(x==s.length()+2){ s += "A"; } else if(x==s.length()+1){ s += "B"; } else{ s += "X"; } } x = press(s+"A"); if(x==N){ s += "A"; } else{ x = press(s+"B"); if(x==N){ s += "B"; } else{ s += "X"; } } } return s; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:31:8: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |    if(x==s.length()+2){
      |       ~^~~~~~~~~~~~~~
combo.cpp:34:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |    else if(x==s.length()+1){
      |            ~^~~~~~~~~~~~~~
combo.cpp:58:8: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   58 |    if(x==s.length()+2){
      |       ~^~~~~~~~~~~~~~
combo.cpp:61:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   61 |    else if(x==s.length()+1){
      |            ~^~~~~~~~~~~~~~
combo.cpp:85:8: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   85 |    if(x==s.length()+2){
      |       ~^~~~~~~~~~~~~~
combo.cpp:88:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   88 |    else if(x==s.length()+1){
      |            ~^~~~~~~~~~~~~~
combo.cpp:112:8: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  112 |    if(x==s.length()+2){
      |       ~^~~~~~~~~~~~~~
combo.cpp:115:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  115 |    else if(x==s.length()+1){
      |            ~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...