Submission #203377

#TimeUsernameProblemLanguageResultExecution timeMemory
2033770gnjenCombo (IOI18_combo)C++14
0 / 100
1 ms200 KiB
#include "combo.h" std::string guess_sequence(int N) { std::string s = ""; int p = press("AB"); if(p > 0) { p = press("A"); if(p == 1) s += 'A'; else s += 'B'; } else { p = press("X"); if(p == 1) s += 'X'; else s += 'B'; } char c1[4], c[3]; c1[0] = 'A'; c1[1] = 'B'; c1[2] = 'X'; c1[3] = 'Y'; for(int i = 0, j = 0; i < 4; i++) { if(c1[i] != s[0]) { c[j] = c1[i]; j++; } } for(int i = 1; i < N-1; i++) { p = press(s+s+c[1]+s+c[2]+c[0]+s+c[2]+c[1]+s+c[2]+s[2]); if(p == s.size()) { s += c[0]; } if(p == s.size()+1) { s += c[1]; } if(p == s.size()+2) { s += c[2]; } } p = press(s+c[0]); if(p == N) { s += c[0]; } else { p = press(s+c[1]); if(p == N) s += c[1]; else s += c[2]; } return s; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:45:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   45 |         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:55:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   55 |         if(p == s.size()+2)
      |            ~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...