Submission #1062762

#TimeUsernameProblemLanguageResultExecution timeMemory
1062762Wasif_ShahzadCombo (IOI18_combo)C++17
10 / 100
34 ms956 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; std::string guess_sequence(int N) { random_device rd; mt19937 g(rd()); vector<char> moves = {'A', 'B', 'X', 'Y'}; string ans; char first; for(int i = 0; i < N; i++){ shuffle(moves.begin(), moves.end(), g); for(char option: moves){ if(i != 0 and option == first) continue; string tmp = ans + option; int cur = press(tmp); if(cur == ans.size() + 1){ ans = tmp; break; } } if(i == 0) first = ans[0]; } return ans; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:18:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |       if(cur == ans.size() + 1){
      |          ~~~~^~~~~~~~~~~~~~~~~
combo.cpp:15:28: warning: 'first' may be used uninitialized in this function [-Wmaybe-uninitialized]
   15 |       if(i != 0 and option == first) continue;
      |                     ~~~~~~~^~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...