Submission #418133

#TimeUsernameProblemLanguageResultExecution timeMemory
418133ja_kingyCombo (IOI18_combo)C++14
5 / 100
1 ms200 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; std::string guess_sequence(int N) { string ls = "ABXY"; string ans; if (press("AB")) { ans = press("A") ? "A" : "B"; } else { ans = press("X") ? "X" : "Y"; } ls.erase(find(ls.begin(), ls.end(), ans[0])); string p; for (int i = 1; i < N-1; ++i) { p = ans + ls[0] + ls[0] + ans + ls[0] + ls[1] + ans + ls[0] + ls[2] + ans + ls[1]; int res = press(p); if (res == ans.size() + 2) { ans.push_back(ls[0]); } else if(res == ans.size()+1) { ans.push_back(ls[1]); } else { ans.push_back(ls[2]); } } p = ans + ls[0]; if (press(p) == N) ans.push_back(ls[0]); else { p = ans + ls[1]; if (press(p) == N) ans.push_back(ls[1]); else { ans.push_back(ls[2]); } } return ans; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:18:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |     if (res == ans.size() + 2) {
      |         ~~~~^~~~~~~~~~~~~~~~~
combo.cpp:20:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |     } else if(res == ans.size()+1) {
      |               ~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...