제출 #786561

#제출 시각아이디문제언어결과실행 시간메모리
786561JoenPoenMan콤보 (IOI18_combo)C++17
5 / 100
1 ms208 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; typedef pair<int, int> ii; vector<char> chars = {'X', 'Y', 'A', 'B'}; string Sol; std::string guess_sequence(int N) { if (press("AB") >= 1) Sol = (press("A") ? "A" : "B"); else Sol = (press("X") ? "X" : "Y"); chars.erase(find(chars.begin(), chars.end(), Sol[0])); for (int i = 1; i < N-1; i++) { string inp; inp += Sol + chars[0]; inp += Sol + chars[1] + chars[0]; inp += Sol + chars[1] + chars[1]; inp += Sol + chars[1] + chars[2]; int res = press(inp); if (res == Sol.length()) Sol.push_back(chars[2]); else if (res == Sol.length()+1) Sol.push_back(chars[0]); else Sol.push_back(chars[1]); } string inp; inp = Sol + chars[0] + Sol + chars[1]; if (press(inp) == Sol.length()) Sol.push_back(chars[2]); else { inp = Sol + chars[0]; if (press(inp) == Sol.length()) Sol.push_back(chars[1]); else Sol.push_back(chars[0]); } //cout << N << endl; //cout << Sol << endl; return Sol; }

컴파일 시 표준 에러 (stderr) 메시지

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:26:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |         if (res == Sol.length()) Sol.push_back(chars[2]);
      |             ~~~~^~~~~~~~~~~~~~~
combo.cpp:27:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |         else if (res == Sol.length()+1) Sol.push_back(chars[0]);
      |                  ~~~~^~~~~~~~~~~~~~~~~
combo.cpp:32:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |     if (press(inp) == Sol.length()) Sol.push_back(chars[2]);
      |         ~~~~~~~~~~~^~~~~~~~~~~~~~~
combo.cpp:35:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |         if (press(inp) == Sol.length()) Sol.push_back(chars[1]);
      |             ~~~~~~~~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...