Submission #1012938

#TimeUsernameProblemLanguageResultExecution timeMemory
1012938rythm_of_knightCombo (IOI18_combo)C++14
30 / 100
18 ms1540 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int n) { string print; int x; char c; vector <string> a(n, "ABXY"); string ans(n, 'C'), pos = "ABXY"; string tayyor; x = press("AB"); if (x) { x = press("A"); if (x) c = 'A'; else c = 'B'; } else { x = press("X"); if (x) c = 'X'; else c = 'Y'; } tayyor.push_back(c); a[0] = c; for (int i = 1; i < n; i++) a[i].erase(a[i].begin() + a[i].find(c)); for (int i = 1; i < n; i++) { if (a[i].size() == 1) { tayyor.push_back(a[i][0]); continue; } string temp = a[i], print, bilet; int j = i + 1; for (; j < n && a[j].size() == 1; bilet.push_back(a[j][0]), j++); if (a[i].size() == 3) { if (j != n) { char c1 = a[j][0]; print = tayyor + temp[0] + bilet + c1 + tayyor + temp[1] + bilet + c1; x = press(print); if (x == tayyor.size()) { a[i] = temp[2], tayyor.push_back(temp[2]); } else if (x == tayyor.size() + 1) { a[j].erase(a[j].begin()); a[i].erase(a[i].begin() + 2); i--; } else { a[i].erase(a[i].begin() + 2); a[j] = c1; i--; } } else { print = tayyor + temp[0] + tayyor + temp[1]; x = press(print); if (x == tayyor.size()) { a[i] = temp[2], tayyor.push_back(temp[2]); } else { a[i].erase(a[i].begin() + 2); i--; } } } else { if (j != n) { char c1 = a[j][0]; print = tayyor + temp[0] + bilet + c1; x = press(print); if (x == tayyor.size()) { a[i] = temp[1]; } else if (x == j) { a[j].erase(a[j].begin()); a[i] = temp[0]; } else { a[i] = temp[0]; a[j] = c1; } } else { print = tayyor + temp[0]; x = press(print); if (x == tayyor.size()) { a[i] = temp[1]; } else { a[i] = temp[0]; } } tayyor.push_back(a[i][0]); } } return tayyor; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:44:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |                 if (x == tayyor.size()) {
      |                     ~~^~~~~~~~~~~~~~~~
combo.cpp:46:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |                 } else if (x == tayyor.size() + 1) {
      |                            ~~^~~~~~~~~~~~~~~~~~~~
combo.cpp:58:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   58 |                 if (x == tayyor.size()) {
      |                     ~~^~~~~~~~~~~~~~~~
combo.cpp:70:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   70 |                 if (x == tayyor.size()) {
      |                     ~~^~~~~~~~~~~~~~~~
combo.cpp:82:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   82 |                 if (x == tayyor.size()) {
      |                     ~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...