Submission #536404

#TimeUsernameProblemLanguageResultExecution timeMemory
536404fuad27Combo (IOI18_combo)C++17
30 / 100
45 ms444 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; char keys[] = {'A','B','X','Y'}; string guess_sequence(int n) { string p = ""; for(int i = 0;i<3;i++) { p.push_back(keys[i]); if(press(p) == 1) { break; } p.pop_back(); } if(p.size() == 0) { p.push_back(keys[3]); } vector<char> keys2; char start = p[0]; for(int i = 0;i<4;i++) { if(keys[i] == start)continue; keys2.push_back(keys[i]); } for(int j = 1;j<n;j++) { for(int i = 0;i<2;i++) { if(keys2[i]==start)continue; p.push_back(keys2[i]); //~ cout << j << " " << p << ": " << press(p) << "\n"; if(press(p) == j+1) { break; } p.pop_back(); } if(p.size()!=j+1) { p.push_back(keys2[2]); } } //~ cout << "ans: " << p << "\n"; return p; }

Compilation message (stderr)

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