Submission #571982

#TimeUsernameProblemLanguageResultExecution timeMemory
571982OrazBCombo (IOI18_combo)C++14
100 / 100
38 ms572 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; vector <char> v; string s; string guess_sequence(int N){ int a = press("AB"); string t = "ABXY"; if (a == 2) s += 'A'; else 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-1; 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:34:9: 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 (x == s.size() + 2) s += v[0];
      |       ~~^~~~~~~~~~~~~~~
combo.cpp:35:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |   else if (x == s.size() + 1) s += v[1];
      |            ~~^~~~~~~~~~~~~~~
combo.cpp:39:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |   if (press (s + v[0]) == s.size() + 1) s += v[0];
      |       ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
combo.cpp:40:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |   else if (press (s + v[1]) == s.size() + 1) s += v[1];
      |            ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...