Submission #139719

#TimeUsernameProblemLanguageResultExecution timeMemory
139719KewoCombo (IOI18_combo)C++17
5 / 100
1 ms200 KiB
#include "combo.h" #include <bits/stdc++.h> #define pb push_back #define ppb pop_back #define fi first #define se second #define mid ((x + y) / 2) #define left (ind * 2) #define right (ind * 2 + 1) #define mp make_pair #define timer ((double)clock() / CLOCKS_PER_SEC) #define endl "\n" #define spc " " #define d1(x) cerr<<#x<<":"<<x<<endl #define d2(x, y) cerr<<#x<<":"<<x<<" "<<#y<<":"<<y<<endl #define d3(x, y, z) cerr<<#x<<":"<<x<<" "<<#y<<":"<<y<<" "<<#z<<":"<<z<<endl #define fast_io() ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0) using namespace std; typedef long long int lli; typedef pair<int, int> ii; typedef pair<ii, int> iii; typedef pair<double, double> dd; const int N = (int)(1e6 + 5); const int LOG = (int)(20); string s; set<char> ost; vector<char> oth; std::string guess_sequence(int N) { ost.insert('A'); ost.insert('B'); ost.insert('X'); ost.insert('Y'); if(press("AB") != 0) { if(press("A") != 0) { s.pb('A'); ost.erase('A'); } else { s.pb('B'); ost.erase('B'); } } else { if(press("X") != 0) { s.pb('X'); ost.erase('X'); } else { s.pb('Y'); ost.erase('Y'); } } for(auto i : ost) oth.pb(i); for(int i = 1; i < N - 1; i++) { string ask = s + oth[0] + s + oth[1] + oth[0] + s + oth[1] + oth[1] + s + oth[1] + oth[2]; int re = press(ask); if(re == s.size()) s.pb(oth[2]); if(re == s.size() + 1) s.pb(oth[0]); if(re == s.size() + 2) s.pb(oth[1]); } if(press(s + oth[0] + s + oth[1]) == s.size() + 1) { if(press(s + oth[0]) == s.size() + 1) return s + oth[0]; else return s + oth[1]; } else return s + oth[2]; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:64:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   64 |   if(re == s.size())
      |      ~~~^~~~~~~~~~~
combo.cpp:66:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   66 |   if(re == s.size() + 1)
      |      ~~~^~~~~~~~~~~~~~~
combo.cpp:68:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   68 |   if(re == s.size() + 2)
      |      ~~~^~~~~~~~~~~~~~~
combo.cpp:71:36: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   71 |  if(press(s + oth[0] + s + oth[1]) == s.size() + 1) {
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
combo.cpp:72:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   72 |   if(press(s + oth[0]) == s.size() + 1)
      |      ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...