Submission #988901

#TimeUsernameProblemLanguageResultExecution timeMemory
988901lo0kerCombo (IOI18_combo)C++17
5 / 100
1 ms408 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { if(N == 1){ if(press("A") == 1){ return "A"; } else if(press("B") == 1){ return "B"; } else if(press("X") == 1){ return "X"; } else "Y"; } string s = ""; int k = press("AB"); if(k > 0){ if(press("A") == 1){ s = "A"; } else{ s = "B"; } } else{ if(press("X") == 1){ s = "X"; } else{ s = "Y"; } } string c = "ABXY"; c.erase(find(c.begin(), c.end(), s[0])); while(s.size() < N-1){ string q = s + c[1] + s + c[2] + c[0] + s + c[2] + c[1] + s + c[2] + c[2]; s += c[press(q) - s.size()]; } if(press(s + c[0]) == N){ s += c[0]; } else if(press(s + c[1]) == N){ s += c[1]; } else{ s += c[2]; } return s; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:18:10: warning: statement has no effect [-Wunused-value]
   18 |     else "Y";
      |          ^~~
combo.cpp:42:18: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   42 |   while(s.size() < N-1){
      |         ~~~~~~~~~^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...