Submission #578409

#TimeUsernameProblemLanguageResultExecution timeMemory
5784091zaid1Combo (IOI18_combo)C++14
100 / 100
38 ms588 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; string guess_sequence(int n) { string s = ""; set<char> st = {'A', 'B', 'X', 'Y'}; if (press("AB") > 0) { if (press("A")) { s += "A"; st.erase('A'); } else { s += "B"; st.erase('B'); } } else { if (press("X")) { s += "X"; st.erase('X'); } else { s += "Y"; st.erase('Y'); } } if (n == 1) return s; string a(1, *st.begin()), b(1, *next(st.begin())), c(1, *next(next(st.begin()))); for (int i = 1; i < n-1; i++) { string p = s+a+b + s+a+a + s+a+c + s+b; int x = press(p); if (x == s.size()+2) s += a; else if (x==s.size()+1) s += b; else s += c; } if (press(s+a + s+b) == n) { if (press(s+a) == n) s += a; else s += b; } else s += c; return s; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
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 (x == s.size()+2) s += a;
      |             ~~^~~~~~~~~~~~~
combo.cpp:33:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |         else if (x==s.size()+1) s += b;
      |                  ~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...