Submission #624321

#TimeUsernameProblemLanguageResultExecution timeMemory
624321speedyArdaCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include "bits/stdc++.h" using namespace std; string letters[4] = {"A", "B", "X", "Y"}; string guess_sequence(int N) { string res = ""; int forbidden; for(int idx = 0; idx < 3; idx++) { string i = letters[idx]; int num = press(i); if(num == 1) { res = i; forbidden = idx; break; } } if(res.size() == 0) { res = "Y"; forbidden = 3; } string available[3]; for(int i = 0; i < 4; i++) { if(forbidden == i) continue; if(i < forbidden) available[i] = letters[i]; else available[i - 1] = letters[i]; } while(res.size() < N) { int curr = 0; string temp = ""; for(int i = 0; i <= 2; i++) { temp += res + available[0] + available[i]; } temp += res + available[1]; int num = press(temp); if(num == res.size()) res += available[2]; else if(num - 1 == res.size()) res += available[1]; else res += available[0]; } return res; } int main() { }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:13:19: error: 'press' was not declared in this scope; did you mean 'res'?
   13 |         int num = press(i);
      |                   ^~~~~
      |                   res
combo.cpp:35:22: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   35 |     while(res.size() < N)
      |           ~~~~~~~~~~~^~~
combo.cpp:44:19: error: 'press' was not declared in this scope; did you mean 'res'?
   44 |         int num = press(temp);
      |                   ^~~~~
      |                   res
combo.cpp:45:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   45 |         if(num == res.size())
      |            ~~~~^~~~~~~~~~~~~
combo.cpp:47:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   47 |         else if(num - 1 == res.size())
      |                 ~~~~~~~~^~~~~~~~~~~~~
combo.cpp:37:13: warning: unused variable 'curr' [-Wunused-variable]
   37 |         int curr = 0;
      |             ^~~~