Submission #728988

#TimeUsernameProblemLanguageResultExecution timeMemory
728988ToxtaqCombo (IOI18_combo)C++17
5 / 100
1 ms208 KiB
#include <bits/stdc++.h> using namespace std; int press(std::string p); std::string guess_sequence(int N){ int n = N; string res = "", s; if(press("A")){ res += 'A'; s = "BXY"; } else if(press("B")){ res += 'B'; s = "AXY"; } else if(press("X")){ res += 'X'; s = "ABY"; } else{ res += 'Y'; s = "ABX"; } for(int i = 1;i < n - 1;++i){ string d = res; d += s[0]; d += res; d += s[1]; d += s[0]; d += res; d += s[1]; d += s[1]; d += res; d += s[1]; d += s[2]; int num = press(d); if(num == res.size() + 1){ res += s[0]; } else if(num == res.size() + 2){ res += s[1]; } else{ res += s[2]; } } string d = res; d += s[0]; if(press(d) == n){ return d; } d.pop_back(); d += s[1]; if(press(d) == n){ return d; } d.pop_back(); d += s[2]; return d; }

Compilation message (stderr)

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