Submission #998328

#TimeUsernameProblemLanguageResultExecution timeMemory
998328Roman70Combo (IOI18_combo)C++17
30 / 100
31 ms848 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int N) { string correct; int sz[3]; sz[0] = sz[1] = sz[2] = 0; char flag; while(correct.size() != N){ if(!correct.size()){ int sz[3]; sz[0] = press("A"); sz[1] = press("B"); sz[2] = press("X"); if(sz[0] == correct.size()+1) { correct.push_back('A'); flag = 'A'; } else if(sz[1]== correct.size()+1){ correct.push_back('B'); flag = 'B'; } else if(sz[2]== correct.size()+1){ correct.push_back('X'); flag = 'X'; } else{ correct.push_back('Y'); flag = 'Y'; } } else{ if(flag == 'A'){ sz[0] = press(correct + "B"); sz[1] = press(correct + "X"); if(sz[0]== correct.size()+1){ correct.push_back('B'); } else if(sz[1]== correct.size()+1){ correct.push_back('X'); } else correct.push_back('Y'); } else if(flag == 'B'){ sz[0] = press(correct + "A"); sz[1] = press(correct + "X"); if(sz[0] == correct.size()+1){ correct.push_back('A'); } else if(sz[1]== correct.size()+1){ correct.push_back('X'); } else correct.push_back('Y'); } else if(flag == 'X'){ sz[0] = press(correct + "A"); sz[1] = press(correct +"B"); if(sz[0]== correct.size()+1){ correct.push_back('A'); } else if(sz[1]== correct.size()+1){ correct.push_back('B'); } else correct.push_back('Y'); } else if(flag == 'Y'){ sz[0] = press(correct + "A"); sz[1] = press(correct +"B"); if(sz[0]== correct.size()+1){ correct.push_back('A'); } else if(sz[1]== correct.size()+1){ correct.push_back('B'); } else correct.push_back('X'); } } } return correct; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:11:26: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   11 |     while(correct.size() != N){
      |           ~~~~~~~~~~~~~~~^~~~
combo.cpp:18:22: 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(sz[0] == correct.size()+1) {
      |                ~~~~~~^~~~~~~~~~~~~~~~~~~
combo.cpp:22:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |             else if(sz[1]== correct.size()+1){
      |                     ~~~~~^~~~~~~~~~~~~~~~~~~
combo.cpp:26:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |             else if(sz[2]== correct.size()+1){
      |                     ~~~~~^~~~~~~~~~~~~~~~~~~
combo.cpp:39:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |             if(sz[0]== correct.size()+1){
      |                ~~~~~^~~~~~~~~~~~~~~~~~~
combo.cpp:42:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |             else if(sz[1]== correct.size()+1){
      |                     ~~~~~^~~~~~~~~~~~~~~~~~~
combo.cpp:51:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   51 |              if(sz[0] == correct.size()+1){
      |                 ~~~~~~^~~~~~~~~~~~~~~~~~~
combo.cpp:54:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   54 |             else if(sz[1]== correct.size()+1){
      |                     ~~~~~^~~~~~~~~~~~~~~~~~~
combo.cpp:64:22: 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(sz[0]== correct.size()+1){
      |                 ~~~~~^~~~~~~~~~~~~~~~~~~
combo.cpp:67:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   67 |             else if(sz[1]== correct.size()+1){
      |                     ~~~~~^~~~~~~~~~~~~~~~~~~
combo.cpp:77:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   77 |              if(sz[0]== correct.size()+1){
      |                 ~~~~~^~~~~~~~~~~~~~~~~~~
combo.cpp:80:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   80 |             else if(sz[1]== correct.size()+1){
      |                     ~~~~~^~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...