Submission #998322

#TimeUsernameProblemLanguageResultExecution timeMemory
998322Roman70Combo (IOI18_combo)C++17
0 / 100
1 ms344 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.push_back('A'); flag = 'A'; } else if(sz[1]){ correct.push_back('B'); flag = 'B'; } else if(sz[2]){ 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.push_back('B'); } else if(sz[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.push_back('A'); } else if(sz[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.push_back('A'); } else if(sz[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.push_back('A'); } else if(sz[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){
      |           ~~~~~~~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...