제출 #1007250

#제출 시각아이디문제언어결과실행 시간메모리
1007250makanhulia콤보 (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int n){ string s=""; int tmp=press("AB"); if(tmp>=1){ tmp=press('A'); if(tmp==1) s+='A'; else s+='B'; } else { tmp=press('X'); if(tmp==1) s+='X'; else s+='Y'; } while(s.length()<n-1){ if(s[0]=='A'){ tmp=press(s+'B'+s+"XX"+s+"XY"+s+"XB"); if(tmp==s.length()+1){ s+='B'; } else if(tmp==s.length()+2){ s+='X'; } else { s+='Y'; } } if(s[0]=='B'){ tmp=press(s+'A'+s+"XX"+s+"XY"+s+"XA"); if(tmp==s.length()+1){ s+='A'; } else if(tmp==s.length()+2){ s+='X'; } else { s+='Y'; } } if(s[0]=='X'){ tmp=press(s+'B'+s+"AA"+s+"AY"+s+"AB"); if(tmp==s.length()+1){ s+='B'; } else if(tmp==s.length()+2){ s+='A'; } else { s+='Y'; } } if(s[0]=='Y'){ tmp=press(s+'B'+s+"AA"+s+"AX"+s+"AB"); if(tmp==s.length()+1){ s+='B'; } else if(tmp==s.length()+2){ s+='A'; } else { s+='X'; } } } if(n>=2){ tmp=press(s+"A"+s+"B"); if(tmp>=n){ tmp=press(s+"A"); if(tmp==n) s+="A"; else s+="B"; } else { tmp=press(s+"X"); if(tmp==n) s+="X"; else s+="Y"; } } return s; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:9:15: error: could not convert ''A'' from 'char' to 'std::string' {aka 'std::__cxx11::basic_string<char>'}
    9 |     tmp=press('A');
      |               ^~~
      |               |
      |               char
combo.cpp:13:15: error: could not convert ''X'' from 'char' to 'std::string' {aka 'std::__cxx11::basic_string<char>'}
   13 |     tmp=press('X');
      |               ^~~
      |               |
      |               char
combo.cpp:17:19: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   17 |   while(s.length()<n-1){
      |         ~~~~~~~~~~^~~~
combo.cpp:20:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |       if(tmp==s.length()+1){
      |          ~~~^~~~~~~~~~~~~~
combo.cpp:22:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |       } else if(tmp==s.length()+2){
      |                 ~~~^~~~~~~~~~~~~~
combo.cpp:30:13: 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(tmp==s.length()+1){
      |          ~~~^~~~~~~~~~~~~~
combo.cpp:32:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |       } else if(tmp==s.length()+2){
      |                 ~~~^~~~~~~~~~~~~~
combo.cpp:40:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |       if(tmp==s.length()+1){
      |          ~~~^~~~~~~~~~~~~~
combo.cpp:42:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |       } else if(tmp==s.length()+2){
      |                 ~~~^~~~~~~~~~~~~~
combo.cpp:50:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   50 |       if(tmp==s.length()+1){
      |          ~~~^~~~~~~~~~~~~~
combo.cpp:52:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   52 |       } else if(tmp==s.length()+2){
      |                 ~~~^~~~~~~~~~~~~~