Submission #110058

#TimeUsernameProblemLanguageResultExecution timeMemory
110058DystoriaXCombo (IOI18_combo)C++14
100 / 100
51 ms596 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; char c[] = {'A', 'B', 'X', 'Y'}; char f[3]; char k; string guess_sequence(int N) { string p = ""; //Find first character int coins; coins = press("AB"); if(coins == 0){ coins = press("X"); if(coins == 1) k = 'X'; else k = 'Y'; } else { coins = press("A"); if(coins == 1) k = 'A'; else k = 'B'; } p += k; if(N == 1) return p; int x = 0; for(int i = 0; i < 4; i++){ if(c[i] == k) continue; f[x++] = c[i]; } for(int i = 1; i < N - 1; i++){ string tp = ""; tp += p + f[0]; for(int j = 0; j < 3; j++) tp += p + f[1] + f[j]; coins = press(tp); if(coins == i) p += f[2]; else if (coins == i + 1) p += f[0]; else p += f[1]; } for(int i = 0; i < 2; i++){ coins = press(p + f[i]); if(coins == N){ p += f[i]; break; } } if(p.size() < N) p += f[2]; return p; }

Compilation message (stderr)

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