Submission #528646

#TimeUsernameProblemLanguageResultExecution timeMemory
528646rayfishCombo (IOI18_combo)C++17
30 / 100
48 ms668 KiB
#include <climits> #include <iostream> #include <algorithm> #include <cmath> #include <deque> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_set> #include <unordered_map> #include <utility> #include <vector> #include "combo.h" using namespace std; using ll = long long; //int press(string s) { // return 0; //} string guess_sequence(int N) { string cur; char letters[] {'A', 'B', 'X', 'Y'}; // find first letter for (int t_i = 0; t_i < 3; t_i++) { if (press(cur + letters[t_i]) == 1) { cur += letters[t_i]; break; } } if (cur.length() == 0) { cur += letters[3]; } // find next letters for (int i = 1; i < N; i++) { int num_c = 0; int t_i = 0; for (; num_c < 2; t_i++) { if (cur[0] == letters[t_i]) continue; if (press(cur + letters[t_i]) == i+1) { cur += letters[t_i]; break; } else { num_c++; } } if (cur.length() == i) { if (t_i == 3) { cur += letters[3]; } else { cur += (cur[0] == letters[2] ? letters[3] : letters[2]); } } } return cur; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:52:26: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   52 |         if (cur.length() == i) {
      |             ~~~~~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...