Submission #587848

#TimeUsernameProblemLanguageResultExecution timeMemory
587848IvanJCombo (IOI18_combo)C++17
5 / 100
1 ms256 KiB
#include "combo.h" #include<bits/stdc++.h> #define all(a) (a).begin(), (a).end() using namespace std; string guess_sequence(int n) { string p = "", S = ""; if(press("A")) S = "A"; else if(press("B")) S = "B"; else if(press("X")) S = "X"; else S = "Y"; set<string> q; q.insert("A"), q.insert("B"), q.insert("X"), q.insert("Y"); q.erase(S); vector<string> v(all(q)); for(int i = 1;i < n - 1;i++) { p = S + v[0]; for(int j = 0;j < 3;j++) p += S + v[1] + v[j]; int x = press(p), m = S.size(); if(x == m + 1) S += v[0]; if(x == m + 2) S += v[1]; if(x == m) S += v[2]; } if(S.size() == n) { string t = ""; for(int i = 0;i < n - 1;i++) t += S[i]; S = t; } assert(S.size() == n - 1); if(press(S + v[0]) == n) S += v[0]; else if(press(S + v[1]) == n) S += v[1]; else S += v[2]; return S; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:28:14: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   28 |  if(S.size() == n) {
      |     ~~~~~~~~~^~~~
In file included from /usr/include/c++/10/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33,
                 from combo.cpp:2:
combo.cpp:34:18: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   34 |  assert(S.size() == n - 1);
      |         ~~~~~~~~~^~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...