Submission #625154

#TimeUsernameProblemLanguageResultExecution timeMemory
625154Mr_HusanboyCombo (IOI18_combo)C++14
5 / 100
1 ms256 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { string p = ""; string let = "ABXY"; map<char,int> used; int n = N; for(int i = 0; i < 4; i ++){ random_shuffle(let.begin(), let.end()); for(auto u : let){ if(used[u]) continue; p.push_back(u); // cout << p << endl; if(press(p) == p.size()) break; p.pop_back(); } used[p.back()] = 0; if(p.size() == n) break; while(p.size() < n){ // cout << p << endl; p.push_back(p.back()); if(press(p) != p.size()){ p.pop_back(); break; } } if(p.size() == n) break; } // cout << p << endl; return p; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:17:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |             if(press(p) == p.size()) break;
      |                ~~~~~~~~~^~~~~~~~~~~
combo.cpp:21:21: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   21 |         if(p.size() == n) break;
      |            ~~~~~~~~~^~~~
combo.cpp:22:24: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   22 |         while(p.size() < n){
      |               ~~~~~~~~~^~~
combo.cpp:25:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |             if(press(p) != p.size()){
      |                ~~~~~~~~~^~~~~~~~~~~
combo.cpp:29:21: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   29 |         if(p.size() == n) break;
      |            ~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...