Submission #571947

#TimeUsernameProblemLanguageResultExecution timeMemory
571947OrazBCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include "combo.h" #include <bits/stdc++.h> #define wr cout << "Continue debugging\n"; #define ll long long int #define pii pair <int, int> #define pb push_back #define ff first #define ss second using namespace std; int n, x, pos; string guess_sequence(int N){ int a = press("AB"); string t = "ABXY", s = ""; if (a){ if (press("A")) s += 'A'; else s += 'B'; }else{ if (press("X")) s += 'X'; else s += 'Y'; } string c = ""; for (int i = 0; i < 4; i++) if (t[i] != s[0]) v.pb(t[i]); for (int i = 1; i < n; i++){ c.clear(); c += s + v[0] + v[0]; c += s + v[0] + v[1]; c += s + v[0] + v[2]; c += s + v[1]; int x = press(c); if (x == s.size() + 2) s += v[0]; else if (x == s.size() + 1) s += v[1]; else s += v[2]; } // if (N > 1){ // if (press (s + v[0]) == s.size() + 1) s += v[0]; // else if (press (s + v[1]) == s.size() + 1) s += v[1]; // else s += v[2]; // } return s; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:24:48: error: 'v' was not declared in this scope
   24 |  for (int i = 0; i < 4; i++) if (t[i] != s[0]) v.pb(t[i]);
      |                                                ^
combo.cpp:27:12: error: 'v' was not declared in this scope
   27 |   c += s + v[0] + v[0];
      |            ^
combo.cpp:32:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |   if (x == s.size() + 2) s += v[0];
      |       ~~^~~~~~~~~~~~~~~
combo.cpp:33:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |   else if (x == s.size() + 1) s += v[1];
      |            ~~^~~~~~~~~~~~~~~