Submission #447534

#TimeUsernameProblemLanguageResultExecution timeMemory
447534MohamedAliSaidaneCombo (IOI18_combo)C++14
5 / 100
1 ms208 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pii; typedef vector<int> vi; #define pb push_back #define popb pop_back #define ff first #define ss second const int MOD = 1e9 + 7; const ll INF = 1e18; string guess_sequence(int n) { char but[4] = {'A','B','X','Y'}; string p = ""; string s = ""; int fr = -1; for(int i = 0; i < 4; i ++) { string g = p + but[i]; int rep = press(g); if(rep == 1) { fr = i; s = g; break; } } int prog = 1; int last = fr; swap(but[fr],but[3]); for(int i = 1; i < n - 1; i ++) { char b = but[0]; char x= but[1]; char y = but[2]; string g = s + b; g += (s + x+x); g += (s+ x+b); g += (s+ x+y); int tent = press(g); if(tent == prog +1) { prog ++; s += b; } else if(tent == prog + 2) { prog ++; s += x; } else { prog ++; s += y; } } for(int j = 0; j < 3; j ++) { int tent = press(s+but[j]); if(tent == n) { s += but[j]; break; } } return s; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:34:7: warning: unused variable 'last' [-Wunused-variable]
   34 |   int last = fr;
      |       ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...