Submission #185348

#TimeUsernameProblemLanguageResultExecution timeMemory
185348oofsauceCombo (IOI18_combo)C++14
100 / 100
52 ms612 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { string search = "ABXY"; int idx = 0; if(press("AB") == 0) idx = 2; string t = ""; t.push_back(search[idx]); if(press(t) == 0) idx ++; // cout << t << endl; // cout << search[idx]; string X = ""; X.push_back(search[idx]); if(N == 1) return X; string ss = ""; for(char c: search) if(c != search[idx]) ss.push_back(c); while(X.size() < N-1) { // string query = ""; // cout << (X+ss[1]) + (X+ss[2]+ss[0]) + (X+ss[2]+ss[1]) + (X+ss[2]+ss[2]) << endl; int c = press((X+ss[1]) + (X+ss[2]+ss[0]) + (X+ss[2]+ss[1]) + (X+ss[2]+ss[2]) ); X += ss[c-(X.size())]; } idx = 0; if(press(X+"A"+X+"B") == N-1) idx = 2; if(press(X + search[idx]) == N-1) idx ++; X.push_back(search[idx]); // cout << X; // int coins = press(p); return X; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:28:18: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   28 |   while(X.size() < N-1) {
      |         ~~~~~~~~~^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...