Submission #1077354

#TimeUsernameProblemLanguageResultExecution timeMemory
1077354asdasdqwerCombo (IOI18_combo)C++14
30 / 100
31 ms968 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; std::string guess_sequence(int N) { string ret; int f1 = press("AB"); if (f1 == 0) { f1 = press("X"); if (f1 == 1) ret += "X"; else ret += "Y"; } else if (f1 == 1) { f1 = press("B"); if (f1 == 1) ret = "B"; else ret = "A"; } else ret = "AB"; vector<string> possible = {"A", "B", "X", "Y"}; possible.erase(std::find(possible.begin(), possible.end(), string(1, ret[0]))); mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); while (ret.size() != N) { shuffle(possible.begin(), possible.end(), rng); int news = press(ret + possible[0] + ret + possible[1]); if (news == ret.size()) { ret += possible.back(); } else { news = press(ret + possible[0]); if (news == ret.size()) ret += possible[1]; else ret += possible[0]; } } return ret; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:26:23: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   26 |     while (ret.size() != N) {
      |            ~~~~~~~~~~~^~~~
combo.cpp:30:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |         if (news == ret.size()) {
      |             ~~~~~^~~~~~~~~~~~~
combo.cpp:36:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |             if (news == ret.size()) ret += possible[1];
      |                 ~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...