Submission #900126

#TimeUsernameProblemLanguageResultExecution timeMemory
900126Omar_ElgedawyCombo (IOI18_combo)C++17
30 / 100
22 ms1768 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; mt19937 mt(time(nullptr)); string guess_sequence(int n) { vector<char> chr; chr.push_back('A'); chr.push_back('B'); chr.push_back('X'); chr.push_back('Y'); string cur = ""; for (int i = 0; i < 4; i++) { cur=chr[i]; if (press(cur)) { break; } } for (int i = 2; i <= n; i++) { string tst[3] = {cur, cur, cur}; for (int k = 0, j = 0; j < 4; j++) { if (chr[j] == cur[0]) { continue; } tst[k] += chr[j]; k++; } int f = mt() % 3; int s = mt() % 3; int th = 0; while (s == f)s = mt() % 3; for (int k = 0; k < 3; k++) { if (k != f && k != s) { th = k; break; } } // cout<<tst[f]<<' '<<tst[s]<<endl; if (press(tst[f] + tst[s]) == tst[f].size()) { if (press(tst[f]) == tst[f].size()) { cur += tst[f].back(); } else cur += tst[s].back(); } else { cur += tst[th].back(); } } // cout<<cur<<el; return cur; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:39:36: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |         if (press(tst[f] + tst[s]) == tst[f].size()) {
      |             ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
combo.cpp:40:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |             if (press(tst[f]) == tst[f].size()) {
      |                 ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...