Submission #1008582

#TimeUsernameProblemLanguageResultExecution timeMemory
1008582nickolasarapidisCombo (IOI18_combo)C++17
0 / 100
16 ms716 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int N){ string S1 = "", S2 = ""; int first = 5, last = 1; //bool a; char buttons[4] = {'A', 'B', 'X', 'Y'}; vector<char> b; // size of b = 3 for(int i = 0; i < 3; i++){ if(press(S1 + buttons[i]) == 1){ first = i; S1 += buttons[i]; S2 += buttons[i]; break; } } if(first == 5){ first = 3; S1 += buttons[3]; S2 += buttons[3]; } // Q = 3 at worst for(int i = 0; i < 4; i++){ if(i != first){ b.push_back(buttons[i]); // New button list } } int prefix; for(int i = 1; i < N; i++){ prefix = press(S1 + b[0] + S2 + b[1]); if(prefix == i){ S1 += b[2]; S2 += b[2]; } else{ S1 += b[0]; S2 += b[1]; } } prefix = press(S1); if(prefix == N){ return S1; } else{ return S2; } }

Compilation message (stderr)

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