Submission #110057

#TimeUsernameProblemLanguageResultExecution timeMemory
110057DystoriaXCombo (IOI18_combo)C++14
0 / 100
2 ms200 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 = press("AB"); if(coins == 2) k = 'A'; else if (coins == 1) k = 'B'; else { coins = press("XY"); if(coins == 2) k = 'X'; else k = 'Y'; } p += k; 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:53:15: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   53 |   if(p.size() < N) p += f[2];
      |      ~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...