Submission #875682

#TimeUsernameProblemLanguageResultExecution timeMemory
875682nasir_bashirovCombo (IOI18_combo)C++11
0 / 100
0 ms344 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; #define db long double #define ll long long #define pii pair<int, int> #define pll pair<ll, ll> #define vi vector<int> #define vl vector<ll> #define vii vector<pii> #define vll vector<pll> #define endl '\n' #define all(x) x.begin(), x.end() #define fastio\ ios_base::sync_with_stdio(0);\ cin.tie(0);\ cout.tie(0)\ string guess_sequence(int n) { string res = ""; vector<string> v; if(press("AB")){ if(press("A")) res = "A", v = {"B", "X", "Y"}; else res = "B", v = {"A", "X", "Y"}; } else{ if(press("X")) res = "X", v = {"A", "B", "Y"}; else res += "Y", v = {"A", "B", "X"}; } for(int i = 1; i <= n - 2; i++){ string cur = res + v[0] + v[0] + res + v[0] + v[1] + res + v[0] + v[2] + res + v[1]; int q = press(cur); if(q == res.size() + 2) res += v[0]; else if(q == res.size() + 1) res += v[1]; else res += v[2]; } if(press(res + "A" + res + "B") == res.size() + 1){ if(press(res + "A") == res.size() + 1) res += "A"; else res += "B"; } else{ if(press(res + "X") == res.size() + 1) res = "X"; else res += "Y"; } // cout << res << endl; return res; } /* res + BX res + BB res + BY res + X */

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
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 |         if(q == res.size() + 2)   res += v[0];
      |            ~~^~~~~~~~~~~~~~~~~
combo.cpp:36:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |         else if(q == res.size() + 1)  res += v[1];
      |                 ~~^~~~~~~~~~~~~~~~~
combo.cpp:39:37: 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(res + "A" + res + "B") == res.size() + 1){
      |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
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 |         if(press(res + "A") == res.size() + 1)  res += "A";
      |            ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
combo.cpp:44:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |         if(press(res + "X") == res.size() + 1)  res = "X";
      |            ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...