Submission #718804

#TimeUsernameProblemLanguageResultExecution timeMemory
718804thimote75Combo (IOI18_combo)C++14
100 / 100
34 ms576 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_start () { if (press("AB") >= 1) { if (press("A") == 1) return "A"; return "B"; } if (press("X") == 1) return "X"; return "Y"; } string state; string start; string h[3]; string H_map[] = { "A", "B", "X", "Y" }; void setup () { int jH = 0; for (int iH = 0; iH < 4; iH ++) { if (H_map[iH] == start) continue ; h[jH] = H_map[iH]; jH ++; } } string get_next () { string guess = state + h[0] + h[0] + state + h[0] + h[1] + state + h[0] + h[2] + state + h[1]; int res = press(guess); if (res == state.size() + 2) return h[0]; if (res == state.size() + 1) return h[1]; return h[2]; } string get_end (int N) { if (press(state + h[0]) == N) return h[0]; if (press(state + h[1]) == N) return h[1]; return h[2]; } string guess_sequence(int N) { start = guess_start(); state = start; setup(); for (int i = 1; i + 1 < N; i ++) state += get_next(); if (N != 1) state += get_end(N); return state; }

Compilation message (stderr)

combo.cpp: In function 'std::string get_next()':
combo.cpp:39:11: 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 (res == state.size() + 2) return h[0];
      |       ~~~~^~~~~~~~~~~~~~~~~~~
combo.cpp:40:11: 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 (res == state.size() + 1) return h[1];
      |       ~~~~^~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...