Submission #1008229

#TimeUsernameProblemLanguageResultExecution timeMemory
1008229aParrotCombo (IOI18_combo)C++14
0 / 100
0 ms344 KiB
#include "bits/stdc++.h" #include "combo.h" using namespace std; #define ll long long #define vi vector<int> #define pb push_back #define coord pair<int, int> const int MOD = 1e9 + 7; const int MAXN = 1e3; // int dp[MAXN]; namespace { constexpr int MAX_N = 2000; constexpr int MAX_NUM_MOVES = 8000; int N; string S; int num_moves; void wrong_answer(const char *MSG) { printf("Wrong Answer: %s\n", MSG); exit(0); } } // namespace string guess_sequence(int N) { // find first letter in 2 presses int res; res = press("AB"); string f; if (res >= 1) { res = press("A"); if (res == 1) { f = "A"; } else { f = "B"; } } else { res = press("X"); if (res == 1) { f = "X"; } else { f = "Y"; } } if (N==1) { return f; } vector<string> chars = {"A", "B", "X", "Y"}; chars.erase(find(chars.begin(), chars.end(), f)); // cout << "left letters:" << endl; // for (string c : chars) { // cout << c << endl; // } // cout << endl; string ans = f; for (int i=1; i<N-1; i++) { // chars has length 3 // excluding last character from chars string g = ans + chars[0]; g += ans + chars[1] + chars[0]; g += ans + chars[1] + chars[1]; g += ans + chars[1] + chars[2]; res = press(g); if (res == (int)ans.length()) { ans += chars[2]; } else if (res == (int)ans.length()+1) { ans += chars[0]; } else { ans += chars[1]; } } // guess last letter res = press(ans + chars[0] + ans + chars[1]); if (res == N) { res = press(ans + chars[0]); if (res == N) { ans += chars[0]; } else { ans += chars[1]; } } else { ans += chars[2]; } cout << "My answer: " << ans << endl; return ans; }

Compilation message (stderr)

combo.cpp:23:6: warning: 'void {anonymous}::wrong_answer(const char*)' defined but not used [-Wunused-function]
   23 | void wrong_answer(const char *MSG) {
      |      ^~~~~~~~~~~~
combo.cpp:21:5: warning: '{anonymous}::num_moves' defined but not used [-Wunused-variable]
   21 | int num_moves;
      |     ^~~~~~~~~
combo.cpp:18:5: warning: '{anonymous}::N' defined but not used [-Wunused-variable]
   18 | int N;
      |     ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...