Submission #154936

#TimeUsernameProblemLanguageResultExecution timeMemory
154936jovan_bCombo (IOI18_combo)C++17
100 / 100
61 ms560 KiB
#include <bits/stdc++.h> using namespace std; #include "combo.h" int n; string s; void pitaj(char a, char b, char c){ string S = ""; S += s; S += a; S += s; S += b; S += a; S += s; S += b; S += b; S += s; S += b; S += c; if(S.size() > 4*n){ string s1 = s+a; if(press(s1) == n){s += a; return;} s1 = s+b; if(press(s1) == n){s += b; return;} s += c; return; } int x = press(S); if(x == s.size()) s += c; if(x == s.size()+1) s += a; if(x == s.size()+2) s += b; } string guess_sequence(int N){ n = N; char koji; int x = press("AB"); if(x){ if(press("A")) koji = 'A'; else koji = 'B'; } else{ if(press("X")) koji = 'X'; else koji = 'Y'; } s += koji; while(s.size() < N){ if(koji == 'A') pitaj('B', 'X', 'Y'); if(koji == 'B') pitaj('A', 'X', 'Y'); if(koji == 'X') pitaj('A', 'B', 'Y'); if(koji == 'Y') pitaj('A', 'B', 'X'); } return s; }

Compilation message (stderr)

combo.cpp: In function 'void pitaj(char, char, char)':
combo.cpp:21:17: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   21 |     if(S.size() > 4*n){
      |        ~~~~~~~~~^~~~~
combo.cpp:30:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |     if(x == s.size()) s += c;
      |        ~~^~~~~~~~~~~
combo.cpp:31:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |     if(x == s.size()+1) s += a;
      |        ~~^~~~~~~~~~~~~
combo.cpp:32:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |     if(x == s.size()+2) s += b;
      |        ~~^~~~~~~~~~~~~
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:48:20: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   48 |     while(s.size() < N){
      |           ~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...