Submission #945554

#TimeUsernameProblemLanguageResultExecution timeMemory
945554SyriusCombo (IOI18_combo)C++14
5 / 100
1 ms344 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; // #define int long long #define pint pair < int , int > #define ll long long #define ff first #define ss second #define fast ios_base::sync_with_stdio(NULL); cin.tie(NULL) const int inf = 1e9 + 9; const int mxn = 2e5 + 2; const int mod = 1e9 + 7; // int press(string p) {} string guess_sequence(int n) { int t1 = press("AB"); int t2 = press("BX"); char a , b , c , z; if (t1 == 0) { a = 'A'; b = 'B'; if (t2 == 0) { z = 'Y'; c = 'X'; } else { z = 'X'; c = 'Y'; } } else { c = 'Y'; b = 'X'; if (t2 == 0) { a = 'B'; z = 'A'; } else { a = 'A'; z = 'B'; } } string str; str = z; for (int i = 0; i < n-2; i++) { // int t = press(str + a + str + b + a + str + b + b + str + b + c); // int sz = str.size(); // if (t - sz == 0) str += c; // else if (t - sz == 1) str += a; // else if (t - sz == 2) str += b; if (press(str + a) == str.size() + 1) str += a; else if (press(str + b) == str.size() + 1) str += b; else str += c; } if (press(str + a) == n) str += a; else if (press(str + b) == n) str += b; else str += c; if (str.size() != n) press("F"); return str; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:57:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   57 |   if (press(str + a) == str.size() + 1) str += a;
      |       ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
combo.cpp:58:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   58 |   else if (press(str + b) == str.size() + 1) str += b;
      |            ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
combo.cpp:66:17: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   66 |  if (str.size() != n) press("F");
      |      ~~~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...