Submission #795652

#TimeUsernameProblemLanguageResultExecution timeMemory
795652NothingXDCombo (IOI18_combo)C++17
100 / 100
30 ms648 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; typedef double ld; typedef complex<ld> point; void debug_out(){cerr << endl;} template<typename Head, typename... Tail> void debug_out(Head H, Tail... T){ cerr << H << ' '; debug_out(T...); } #define debug(...) cerr << "(" << #__VA_ARGS__ << "): ", debug_out(__VA_ARGS__) #define F first #define S second #define all(x) x.begin(), x.end() #define MP(x, y) make_pair(x, y) const int maxn = 2e3 + 10; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); int n, ptr[maxn]; vector<string> val[maxn]; std::string guess_sequence(int N) { n = N; vector<string> av = {"A", "B", "X", "Y"}; string res; if (press(av[0]+av[1])){ if (press(av[0])){ res = av[0]; av.erase(av.begin()); } else{ res = av[1]; av.erase(av.begin()+1); } } else{ if (press(av[2])){ res = av[2]; av.erase(av.begin()+2); } else{ res = av[3]; av.erase(av.begin()+3); } } if (n == 1) return res; for (int i = 1; i < n-1; i++){ string ask = res; ask += av[0]; ask += res; ask += av[1]; ask += av[0]; ask += res; ask += av[1]; ask += av[1]; ask += res; ask += av[1]; ask += av[2]; int tmp = press(ask); if (tmp == i){ res += av[2]; } else if (tmp == i+1){ res += av[0]; } else{ res += av[1]; } } for (int i = 0; i < 2; i++){ string ask = res + av[i]; if (press(ask) == n){ res += av[i]; break; } } if (res.size() == n-1) res += av[2]; return res; }

Compilation message (stderr)

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