제출 #424584

#제출 시각아이디문제언어결과실행 시간메모리
424584Trunkty콤보 (IOI18_combo)C++14
100 / 100
42 ms672 KiB
#include <iostream> #include "combo.h" using namespace std; int x; string guess_sequence(int N){ string s; if(N==1){ x = press("A"); if(x){ return "A"; } x = press("B"); if(x){ return "B"; } x = press("X"); if(x){ return "X"; } else{ return "Y"; } } 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:48:8: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   48 |    if(x==s.length()+2){
      |       ~^~~~~~~~~~~~~~
combo.cpp:51:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   51 |    else if(x==s.length()+1){
      |            ~^~~~~~~~~~~~~~
combo.cpp:75:8: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   75 |    if(x==s.length()+2){
      |       ~^~~~~~~~~~~~~~
combo.cpp:78:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   78 |    else if(x==s.length()+1){
      |            ~^~~~~~~~~~~~~~
combo.cpp:102:8: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  102 |    if(x==s.length()+2){
      |       ~^~~~~~~~~~~~~~
combo.cpp:105:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  105 |    else if(x==s.length()+1){
      |            ~^~~~~~~~~~~~~~
combo.cpp:129:8: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  129 |    if(x==s.length()+2){
      |       ~^~~~~~~~~~~~~~
combo.cpp:132:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  132 |    else if(x==s.length()+1){
      |            ~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...