Submission #140775

#TimeUsernameProblemLanguageResultExecution timeMemory
140775caoashCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N){ string soFar; string first = "A"; if(press("B")){ first = "B"; } else if(press("Y")){ first = "Y"; } else if(press("X")){ first = "X"; } soFar += first; string c1,c2,c3; if(first == "A"){ c1 = "X"; c2 = "Y"; c3 = "B"; } else if(first == "B"){ c1 = "X"; c2 = "Y"; c3 = "A"; } else if(first == "X"){ c1 = "B"; c2 = "Y"; c3 = "A"; } else if(first == "Y"){ c1 = "X"; c2 = "B"; c3 = "A"; } for(int i = 1; i < N-1; i++){ int val = press(soFar + c1 + c1 + soFar + c1 + c2 + soFar + c1 + c3 + soFar + c2); if(val == soFar.size()){ soFar += c3; } else if(val == soFar.size()+1){ soFar += c2; } else{ soFar += c1; } } if (press(soFar + c1 + soFar + c2) == N) { if (press(s + c1) == N) soFar += c1; else s += c2; } else s += c3; return soFar; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:34:10: 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(val == soFar.size()){
      |      ~~~~^~~~~~~~~~~~~~~
combo.cpp:37:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |   else if(val == soFar.size()+1){
      |           ~~~~^~~~~~~~~~~~~~~~~
combo.cpp:45:13: error: 's' was not declared in this scope
   45 |   if (press(s + c1) == N) soFar += c1;
      |             ^
combo.cpp:47:9: error: 's' was not declared in this scope
   47 |  } else s += c3;
      |         ^