Submission #349164

#TimeUsernameProblemLanguageResultExecution timeMemory
349164zggfCombo (IOI18_combo)C++14
0 / 100
1 ms200 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { char firstLetter; if(press("X")) firstLetter = 'X'; else if(press("Y")) firstLetter = 'Y'; else if(press("A")) firstLetter = 'A'; else if(press("B")) firstLetter = 'B'; string wyn = ""; wyn.push_back(firstLetter); for(int i = 1; i < N-1; i++){ if(firstLetter=='A'){ int tmp = press(wyn+"X"+wyn+"YX"+wyn+"YB"+wyn+"YY"); if(tmp==wyn.size()){ wyn.push_back('B'); }else if(tmp==wyn.size()+1){ wyn.push_back('X'); }else wyn.push_back('Y'); } if(firstLetter=='B'){ int tmp = press(wyn+"X"+wyn+"YX"+wyn+"YA"+wyn+"YY"); if(tmp==wyn.size()){ wyn.push_back('A'); }else if(tmp==wyn.size()+1){ wyn.push_back('X'); }else wyn.push_back('Y'); } if(firstLetter=='X'){ int tmp = press(wyn+"B"+wyn+"YB"+wyn+"YA"+wyn+"YY"); if(tmp==wyn.size()){ wyn.push_back('A'); }else if(tmp==wyn.size()+1){ wyn.push_back('B'); }else wyn.push_back('Y'); } if(firstLetter=='Y'){ int tmp = press(wyn+"B"+wyn+"XB"+wyn+"XA"+wyn+"XX"); if(tmp==wyn.size()){ wyn.push_back('A'); }else if(tmp==wyn.size()+1){ wyn.push_back('B'); }else wyn.push_back('X'); } } char lastLetter; if(firstLetter!='X'&&press(wyn+"X")) lastLetter = 'X'; else if(firstLetter!='Y'&&press(wyn+"Y")) lastLetter = 'Y'; else if(firstLetter!='A'&&press(wyn+"A")) lastLetter = 'A'; else if(firstLetter!='B'&&press(wyn+"B")) lastLetter = 'B'; wyn.push_back(lastLetter); return wyn; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:19:10: 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(tmp==wyn.size()){
      |       ~~~^~~~~~~~~~~~
combo.cpp:21:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |    }else if(tmp==wyn.size()+1){
      |             ~~~^~~~~~~~~~~~~~
combo.cpp:27:10: 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(tmp==wyn.size()){
      |       ~~~^~~~~~~~~~~~
combo.cpp:29:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |    }else if(tmp==wyn.size()+1){
      |             ~~~^~~~~~~~~~~~~~
combo.cpp:35:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |    if(tmp==wyn.size()){
      |       ~~~^~~~~~~~~~~~
combo.cpp:37:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |    }else if(tmp==wyn.size()+1){
      |             ~~~^~~~~~~~~~~~~~
combo.cpp:43:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |    if(tmp==wyn.size()){
      |       ~~~^~~~~~~~~~~~
combo.cpp:45:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   45 |    }else if(tmp==wyn.size()+1){
      |             ~~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...