Submission #127874

#TimeUsernameProblemLanguageResultExecution timeMemory
127874super_j6Combo (IOI18_combo)C++14
100 / 100
49 ms580 KiB
#include "combo.h" #include <iostream> #include <cstdio> #include <algorithm> #include <string.h> using namespace std; #define endl '\n' string s = ""; char c[4] = {'A', 'B', 'X', 'Y'}; int bad = 4; char r(int x){ return c[x + (x >= bad)]; } void find1(){ if(press(s + r(0) + s + r(1)) > s.size()){ if(press(s + r(0)) > s.size()){ s += r(0); bad = 0; }else{ s += r(1); bad = 1; } }else{ if(press(s + r(2)) > s.size()){ s += r(2); bad = 2; }else{ s += r(3); bad = 3; } } } void find2(){ int x = press(s + r(1) + s + r(2) + r(0) + s + r(2) + r(1) + s + r(2) + r(2)) - s.size(); if(x == 0){ s += r(0); }else if(x == 1){ s += r(1); }else{ s += r(2); } } string guess_sequence(int n){ for(int i = 0; i < n; i++){ if(i == 0 || i == n - 1) find1(); else find2(); } return s; }

Compilation message (stderr)

combo.cpp: In function 'void find1()':
combo.cpp:18:32: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |  if(press(s + r(0) + s + r(1)) > s.size()){
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
combo.cpp:19:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |   if(press(s + r(0)) > s.size()){
      |      ~~~~~~~~~~~~~~~~^~~~~~~~~~
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 |   if(press(s + r(2)) > s.size()){
      |      ~~~~~~~~~~~~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...