제출 #1012871

#제출 시각아이디문제언어결과실행 시간메모리
1012871rythm_of_knight콤보 (IOI18_combo)C++14
5 / 100
6 ms600 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]; int j = i + 1; for (; j < n && a[j].size() == 1; j++); if (a[i].size() == 3) { if (j != n) { char c1 = a[j][0]; print = tayyor + temp[0] + c1 + tayyor + temp[1] + 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[j].find(c1)); a[i].erase(a[i].begin() + a[i].find(temp[2])); i--; } else { a[i].erase(a[i].begin() + a[i].find(temp[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() + a[i].find(temp[2])); i--; } } } else { if (j != n) { char c1 = a[j][0]; print = tayyor + temp[0] + c1; x = press(print); if (x == tayyor.size()) { a[i] = temp[1]; } else if (x == tayyor.size() + 1) { a[j].erase(a[j].begin() + a[j].find(c1)); 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; }

컴파일 시 표준 에러 (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:72:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   72 |                 } else if (x == tayyor.size() + 1) {
      |                            ~~^~~~~~~~~~~~~~~~~~~~
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...