Submission #203386

#TimeUsernameProblemLanguageResultExecution timeMemory
2033860gnjenCombo (IOI18_combo)C++14
5 / 100
3 ms256 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; std::string guess_sequence(int N) { //cout << N << endl; string s = ""; string c = "ABXY"; if(press("AB")) { if(press("A")) { s += 'A'; c.erase(c.begin()); } else { s += 'B'; c.erase(c.begin()+1); } } else { if(press("X")) { s += 'X'; c.erase(c.begin()+2); } else { s += 'Y'; c.erase(c.begin()+3); } } for(int i = 1; i < N-1; i++) { //cout << i << endl; int p = press(s+c[1]+s+c[2]+c[0]+s+c[2]+c[1]+s+c[2]+c[2]); if(p == s.size()) s += c[0]; if(p == s.size()+1) s += c[1]; if(p == s.size()+2) s += c[2]; } if(press(s+c[0]+s+c[1]) == s.size()+1) { if(press(s+c[0]) == s.size()+1) s += c[0]; else s += c[1]; } else s += c[2]; return s; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:47:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   47 |         if(p == s.size())
      |            ~~^~~~~~~~~~~
combo.cpp:50:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   50 |         if(p == s.size()+1)
      |            ~~^~~~~~~~~~~~~
combo.cpp:53:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   53 |         if(p == s.size()+2)
      |            ~~^~~~~~~~~~~~~
combo.cpp:57:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   57 |     if(press(s+c[0]+s+c[1]) == s.size()+1)
      |        ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
combo.cpp:59:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   59 |         if(press(s+c[0]) == s.size()+1)
      |            ~~~~~~~~~~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...