Submission #998321

#TimeUsernameProblemLanguageResultExecution timeMemory
998321Roman70Combo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { string correct; int sz[3]; sz[0] = sz[1] = sz[2] = 0; char flag; while(correct.size() != N){ if(!correct.size()){ int sz[3]; sz[0] = press("A"); sz[1] = press("B"); sz[2] = press("X"); if(sz[0]) { correct.push_back('A'); flag = 'A'; } else if(sz[1]){ correct.push_back('B'); flag = 'B'; } else if(sz[2]){ correct.push_back('X'); flag = 'X'; } else{ correct.push_back('Y'); flag = 'Y'; } } else{ if(flag == 'A'){ sz[0] = press(correct + "B"); sz[1] = press(correct + "X"); if(sz[0]){ correct.push_back('B'); } else if(sz[1]){ correct.push_back('X'); } else correct.push_back('Y'); } else if(flag == 'B'){ sz[0] = press(correct + "A"); sz[1] = press(correct + "X"); if(sz[0]){ correct.push_back('A'); } else if(sz[1]){ correct.push_back('X'); } else correct.push_back('Y'); } else if(flag == 'X'){ sz[0] = press(correct + "A"); sz[1] = press(correct +"B"); if(sz[0]){ correct.push_back('A'); } else if(sz[1]){ correct.push_back('B'); } else correct.push_back('Y'); } else if(flag == 'Y'){ sz[0] = press(correct + "A"); sz[1] = press(correct +"B"); if(sz[0]){ correct.push_back('A'); } else if(sz[1]){ correct.push_back('B'); } else correct.push_back('X'); } } } return correct; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:10:26: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   10 |     while(correct.size() != N){
      |           ~~~~~~~~~~~~~~~^~~~
combo.cpp:14:21: error: 'press' was not declared in this scope
   14 |             sz[0] = press("A");
      |                     ^~~~~
combo.cpp:36:26: error: 'press' was not declared in this scope
   36 |                  sz[0] = press(correct + "B");
      |                          ^~~~~
combo.cpp:48:26: error: 'press' was not declared in this scope
   48 |                  sz[0] = press(correct + "A");
      |                          ^~~~~
combo.cpp:61:26: error: 'press' was not declared in this scope
   61 |                  sz[0] = press(correct + "A");
      |                          ^~~~~
combo.cpp:74:26: error: 'press' was not declared in this scope
   74 |                  sz[0] = press(correct + "A");
      |                          ^~~~~