Submission #445489

#TimeUsernameProblemLanguageResultExecution timeMemory
445489PiejanVDCCombo (IOI18_combo)C++17
10 / 100
73 ms576 KiB
#include <combo.h> #include <bits/stdc++.h> using namespace std; string guess_sequence(int n) { //for the first character string s=""; if(press("A")) { s+='A'; } else if(press("B")) { s+='B'; } else if(press("X")) { s+='X'; } else { s+='Y'; } vector<char>str={'A','B','X','Y'}; while(s.length() < n) { for(auto z : str) { if(z != s[0]) { string prev = s; s+=z; if(press(s) == s.length()) { break; } s=prev; } } } return s; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:19:22: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   19 |     while(s.length() < n) {
      |           ~~~~~~~~~~~^~~
combo.cpp:24:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |                 if(press(s) == s.length()) {
      |                    ~~~~~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...