Submission #875617

#TimeUsernameProblemLanguageResultExecution timeMemory
875617nasir_bashirovCombo (IOI18_combo)C++11
5 / 100
31 ms952 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) { srand(time(0)); string res = ""; set<string> st = {"A", "B", "X", "Y"}; for(string s : {"A", "B", "X", "Y"}){ if(press(s)){ res = s; st.erase(s); break; } } for(int i = 2; i <= n; i++){ while(true){ int ind = rand() % 3; auto it = st.begin(); while(ind--) it++; if(press(res + *it) == res.size() + 1){ res += *it; break; } } } return res; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:37:33: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |             if(press(res + *it) == res.size() + 1){
      |                ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...