Submission #741749

#TimeUsernameProblemLanguageResultExecution timeMemory
741749MODDI콤보 (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; std::string guess_sequence(int N) { string str; if(press("AB")){ if(press("A")) str += "A"; else str += "B"; } else{ if(press("X")) str += "X"; else str += "Y"; } if(n==1) return str; while(str.size() < n-1){ int val = press(str + "B" + str + "XB" + str + "XX" + str + "XY"); if(val == str.size()){ str += "Y"; } else if(val == str.size()+1){ str += "B"; } else if(val == str.size()+2) str += "X"; else str += "A"; } for(int j = 0; j < 2; j++){ str.pb(char(j+'A')); if(press(str) == n) return str; str.pop_back(); } str.pb("Y"); return str; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:14:5: error: 'n' was not declared in this scope
   14 |  if(n==1) return str;
      |     ^
combo.cpp:15:21: error: 'n' was not declared in this scope
   15 |  while(str.size() < n-1){
      |                     ^
combo.cpp:17:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |   if(val == str.size()){
      |      ~~~~^~~~~~~~~~~~~
combo.cpp:20:15: 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(val == str.size()+1){
      |           ~~~~^~~~~~~~~~~~~~~
combo.cpp:23:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |   else if(val == str.size()+2)
      |           ~~~~^~~~~~~~~~~~~~~
combo.cpp:29:7: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'pb'
   29 |   str.pb(char(j+'A'));
      |       ^~
combo.cpp:30:20: error: 'n' was not declared in this scope
   30 |   if(press(str) == n) return str;
      |                    ^
combo.cpp:34:6: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'pb'
   34 |  str.pb("Y");
      |      ^~