Submission #764086

#TimeUsernameProblemLanguageResultExecution timeMemory
764086BlagojCombo (IOI18_combo)C++17
0 / 100
64 ms208 KiB
#include "combo.h" #include <bits/stdc++.h> #pragma GCC optimize("Ofast,unroll-loops") using namespace std; #define endl '\n' #define ll long long #define all(x) x.begin(), x.end() string guess_sequence(int N) { string cur = "ABXY", temp = ""; char first; if (press("AB")) { if (press("A")) first = 'A'; else first = 'B'; } else { if (press("X")) first = 'X'; else first = 'Y'; } cur.erase(find(all(cur), first)); if (N == 1) return cur; while (temp.size() < N - 1) { string t = temp + cur[0]; for (auto x : cur) t += temp + cur[1] + x; int v = press(t); if (v == temp.size()) temp += cur[2]; if (v == temp.size() + 1) temp += cur[0]; if (v == temp.size() + 2) temp += cur[1]; } for (int i = 0; i < 2; i++) { temp += cur[i]; if (press(temp) == N) return temp; temp.pop_back(); } temp.push_back(cur[2]); return temp; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:26:24: 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 (temp.size() < N - 1) {
      |            ~~~~~~~~~~~~^~~~~~~
combo.cpp:30:15: 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 (v == temp.size()) temp += cur[2];
      |             ~~^~~~~~~~~~~~~~
combo.cpp:31:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |         if (v == temp.size() + 1) temp += cur[0];
      |             ~~^~~~~~~~~~~~~~~~~~
combo.cpp:32:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |         if (v == temp.size() + 2) temp += cur[1];
      |             ~~^~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...