Submission #933845

#TimeUsernameProblemLanguageResultExecution timeMemory
933845emad234Combo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define ll long long #define F first #define S second #define pii pair<int,int> const int mod = 1e9 + 7; const int mxN = 2e5 + 5; using namespace std; string guess_sequence(int N) { string s = ""; int x = press("XY"); if(x == 2) s += "XY"; else if(x == 1){ if(press("X") == 1) s += "X"; else s += "Y"; }else{ if(press("A") == 1) s += "A"; else s += "B"; } string a = "A",b = "B",c = "X"; char a1 = 'A',b1 = 'B',c1 = 'X'; if(s[0] == a1) a = "Y"; if(s[0] == b1) b = "Y"; if(s[0] == c1) c = "Y"; for(int i = s.size();i < N;i++){ if(i == N - 1){ int x = press(s + a + s + b); if(x == s.size() + 1){ if(press(s + a) == s.size() + 1) s += a; else s += b; } else s += c; break; } string S = s + a + s + b + a + s + b + b + s + b + c; cout<<S<<'\n'; x = press(S); if(x == s.size()) { s += c; } else if(x == s.size() + 1) s += a; else s += b; } return s; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:13:10: error: 'press' was not declared in this scope
   13 |  int x = press("XY");
      |          ^~~~~
combo.cpp:30:9: 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(x == s.size() + 1){
      |       ~~^~~~~~~~~~~~~~~
combo.cpp:40:8: 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(x == s.size()) {
      |      ~~^~~~~~~~~~~
combo.cpp:43:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |   else if(x == s.size() + 1) s += a;
      |           ~~^~~~~~~~~~~~~~~