Submission #1052192

#TimeUsernameProblemLanguageResultExecution timeMemory
1052192khanhtbCombo (IOI18_combo)C++14
5 / 100
1 ms344 KiB
#include <bits/stdc++.h> #include "combo.h" #define ll long long #define ull unsigned long long #define ld long double #define pb push_back #define pf push_front #define vi vector<ll> #define vii vector<vi> #define pll pair<ll, ll> #define vpll vector<pll> #define all(a) a.begin(), a.end() #define fi first #define se second using namespace std; const ll mod = 1e9+7; const ll inf = 2e18; const ll B = 320; const ll N = 1e5+8; string ans = ""; vector<char> bt = {'A','B','X','Y'}; string guess_sequence(int N){ int fid = 0; if(press("AB")){ if(press("A")) fid = 0; else fid = 1; } else{ if(press("X")) fid = 2; else fid = 3; } ans += bt[fid]; int x = -1, y = -1, z = -1; for(int i = 0; i < 4; i++){ if(i == fid) continue; if(x == -1) x = i; else if(y == -1) y = i; else z = i; } for(int i = 2; i < N; i++){ string query = (ans + bt[x]) + (ans + bt[y] + bt[x]) + (ans + bt[y] + bt[y]) + (ans + bt[y] + bt[z]); int rep = press(query); if(rep == ans.size()+1) ans += bt[x]; else if(rep == ans.size()+2) ans += bt[y]; else ans += bt[z]; } string query1 = ans + bt[x], query2 = ans + bt[y]; if (press(query1) == N) return query1; if (press(query2) == N) return query2; return ans + bt[z]; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:43:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |         if(rep == ans.size()+1) ans += bt[x];
      |            ~~~~^~~~~~~~~~~~~~~
combo.cpp:44:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |         else if(rep == ans.size()+2) ans += bt[y];
      |                 ~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...