Submission #395104

#TimeUsernameProblemLanguageResultExecution timeMemory
395104jeroenodbCombo (IOI18_combo)C++14
0 / 100
1 ms200 KiB
#include "combo.h" #include "bits/stdc++.h" using namespace std; #define all(x) begin(x),end(x) template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; } template<typename T_container, typename T = typename enable_if<!is_same<T_container, string>::value, typename T_container::value_type>::type> ostream& operator<<(ostream &os, const T_container &v) { string sep; for (const T &x : v) os << sep << x, sep = " "; return os; } #define debug(a) cerr << "(" << #a << ": " << a << ")\n"; typedef long long ll; typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<int,int> pi; const int mxN = 1e5+1, oo = 1e9; std::string guess_sequence(int N) { int n = N; string but = "ABXY"; if(press("AB")) { swap(but[press("B")], but[0]); } else { swap(but[press("D")+2], but[0]); } string pref; pref+=but[0]; for(int i=1;i<n-1;++i) { string query = pref+but[1]; for(int j=1;j<4;++j) { query+=pref+but[2]+but[j]; } int coins = press(query); if(coins == pref.size()) { pref+=but[3]; } else if(coins == pref.size()+1) { pref+=but[1]; } else { pref+=but[2]; } } // check last character random_shuffle(but.begin()+1, but.end()); if(press(pref+but[1]+pref+but[2])==n) { if(press(pref+but[1])) { pref+=but[1]; } else pref+=but[2]; } else pref+=but[3]; return pref; }

Compilation message (stderr)

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