Submission #529055

#TimeUsernameProblemLanguageResultExecution timeMemory
529055pokmui9909Combo (IOI18_combo)C++17
100 / 100
31 ms688 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; using ll = long long; 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; if(S != "A") V.push_back("A"); if(S != "B") V.push_back("B"); if(S != "X") V.push_back("X"); if(S != "Y") V.push_back("Y"); string P = V[0], Q = V[1], R = V[2]; for(int i = 2; i <= N - 1; i++){ ll k = press(S + P + P + S + P + Q + S + P + R + S + Q); if(k == S.size() + 2){ S += P; } else if(k == S.size() + 1){ S += Q; } else { S += R; } } if(N != 1){ if(press(S + P) > S.size()){ S += P; } else if(press(S + Q) > S.size()) { S += Q; } else { S += R; } } return S; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:29:14: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |         if(k == S.size() + 2){
      |            ~~^~~~~~~~~~~~~~~
combo.cpp:31:21: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |         } else if(k == S.size() + 1){
      |                   ~~^~~~~~~~~~~~~~~
combo.cpp:38:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |         if(press(S + P) > S.size()){
      |            ~~~~~~~~~~~~~^~~~~~~~~~
combo.cpp:40:32: 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(press(S + Q) > S.size()) {
      |                   ~~~~~~~~~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...