Submission #1008381

#TimeUsernameProblemLanguageResultExecution timeMemory
1008381HappyCapybaraCombo (IOI18_combo)C++17
5 / 100
1 ms408 KiB
#include "combo.h" #include<bits/stdc++.h> 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> v; for (string x : {"A", "B", "X", "Y"}) if (s != x) v.push_back(x); while (s.size() < N-1){ string p; p += s; p += v[0]; for (int i=0; i<3; i++){ p += s; p += v[1]; p += v[i]; } int res = press(p); if (res == s.size()+1) s += v[0]; else if (res == s.size()+2) s += v[1]; else s += v[2]; } if (press(s+v[0]) == N) return s+v[0]; if (press(s+v[1]) == N) return s+v[1]; return s+v[2]; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:17:21: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   17 |     while (s.size() < N-1){
      |            ~~~~~~~~~^~~~~
combo.cpp:27:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |         if (res == s.size()+1) s += v[0];
      |             ~~~~^~~~~~~~~~~~~
combo.cpp:28:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |         else if (res == s.size()+2) s += v[1];
      |                  ~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...