Submission #1010218

#TimeUsernameProblemLanguageResultExecution timeMemory
1010218baotoan655Combo (IOI18_combo)C++17
0 / 100
1 ms356 KiB
#include <bits/stdc++.h> // #ifdef ONLINE_JUDGE #include "combo.h" // #endif #define file(name) if (fopen(name".inp", "r")) { freopen(name".inp", "r", stdin); freopen(name".out", "w", stdout); } #define FOR(i, a, b) for(int i = (a); i <= (b); ++i) #define FOD(i, b, a) for(int i = (b); i >= (a); --i) #define ll long long #define fi first #define se second using namespace std; string guess_sequence(int N) { string s; if(press("AB")) { if(press("A")) s = "A"; else s = "B"; } else { if(press("X")) s = "X"; else s = "Y"; } vector<string> ve; for(string str : {"A", "B", "X", "Y"}) if(str != s) ve.emplace_back(str); while(s.size() < N) { // cout << s << ' '; string p; p = s; p += ve[0]; p += s; p += ve[1]; p += ve[0]; p += s; p += ve[1]; p += ve[1]; p += s; p += ve[1]; p += ve[2]; int res = press(p); int sz = s.size(); if(res == sz + 1) s += ve[0]; else if(res == sz + 2) s += ve[1]; else s += ve[2]; } return s; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:28:20: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   28 |     while(s.size() < N) {
      |           ~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...