Submission #401700

#TimeUsernameProblemLanguageResultExecution timeMemory
401700dxz05Combo (IOI18_combo)C++14
0 / 100
1 ms200 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; vector<char> abxy = {'A', 'B', 'X', 'Y'}; string guess_sequence(int n) { return "A"; string s; for (int i = 0; i < 3; i++){ string p; p += abxy[i]; if (press(p) == 1){ s = p; break; } } if (s.empty()) s = "Y"; for (int i = 0; i < 4; i++){ if (abxy[i] == s[0]){ abxy.erase(abxy.begin() + i, abxy.begin() + i + 1); break; } } while (s.size() < n - 1){ string p; for (int i = 0; i < 3; i++){ p += s + abxy[0] + abxy[i]; } p += s + abxy[1]; cout << p << endl; int x = press(p); char ch; if (x == s.size()) ch = abxy[2]; else if (x == s.size() + 1) ch = abxy[1]; else ch = abxy[0]; s += ch; } if (press(s + abxy[0]) == n){ s += abxy[0]; } else if (press(s + abxy[1]) == n){ s += abxy[1]; } else s += abxy[2]; return s; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:29:21: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   29 |     while (s.size() < n - 1){
      |            ~~~~~~~~~^~~~~~~
combo.cpp:41:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |         if (x == s.size()) ch = abxy[2]; else
      |             ~~^~~~~~~~~~~
combo.cpp:42:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |         if (x == s.size() + 1) ch = abxy[1]; else
      |             ~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...