Submission #96081

#TimeUsernameProblemLanguageResultExecution timeMemory
96081bogdan10bosCombo (IOI18_combo)C++14
0 / 100
1 ms328 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; const char ltr[] = {'A', 'B', 'X', 'Y'}; vector<char> can[2005]; string guess_sequence(int N) { char start = 0; if(press("AB")) { if(press("A")) start = 'A'; else start = 'B'; } else { if(press("X")) start = 'X'; else start= 'Y'; } string pfx = ""; pfx += start; vector<char> l; for(int i = 0; i < 4; i++) if(ltr[i] != start) l.push_back(ltr[i]); for(int i = 1; i < N; i++) { string qry = (pfx + l[0]) + (pfx + l[1] + l[0]) + (pfx + l[1] + l[1]) + (pfx + l[1] + l[2]); int prs = press(qry); if(prs == 0) pfx += l[2]; else if(prs == 1) pfx += l[0]; else pfx += l[1]; } if(press(pfx + l[0] + pfx + l[1]) == pfx.size()) pfx += l[2]; else { if(press(pfx + l[0]) == pfx.size()) pfx += l[1]; else pfx += l[0]; } return pfx; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:38:39: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |     if(press(pfx + l[0] + pfx + l[1]) == pfx.size())  pfx += l[2];
      |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
combo.cpp:41:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |         if(press(pfx + l[0]) == pfx.size()) pfx += l[1];
      |            ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...