Submission #79832

#TimeUsernameProblemLanguageResultExecution timeMemory
79832muradeynCombo (IOI18_combo)C++14
5 / 100
2 ms276 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { string res; vector<char>v; if (press("AB") >= 1) { if (press("A") == 1)res = "A"; else res = "B"; } else { if (press("X") == 1)res = "X"; else res = "Y"; } if (res[0] != 'X')v.push_back('X'); if (res[0] != 'Y')v.push_back('Y'); if (res[0] != 'A')v.push_back('A'); if (res[0] != 'B')v.push_back('B'); while (res.length() < N - 1) { string query = res + v[0] + res + v[1] + v[0] + res + v[1] + v[1] + res + v[1] + v[2]; //cout<<query<<endl; int val = press(query); //cout<<val<<endl; if (val == res.length()+2)res += v[1]; else if (val == res.length()+1)res += v[0]; else res += v[2]; } if (press(res + v[0]) == N)res += v[0]; else if (press(res + v[1]) == N)res += v[1]; else if (press(res + v[2]) == N)res += v[2]; return res; }

Compilation message (stderr)

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