제출 #1071725

#제출 시각아이디문제언어결과실행 시간메모리
1071725Rigobertus콤보 (IOI18_combo)C++17
0 / 100
1 ms344 KiB
#include <iostream> #include <algorithm> #include <vector> #include <map> #include <set> #include <queue> #include <string> //#define int long long #include "combo.h" using namespace std; string guess_sequence(int n) { string c[4] = {"A", "B", "X", "Y"}; string s = ""; set<int> vis; for (int i = 0; i < 4; i++) { vis.insert(i); } int j; for (int i = 0; i < 4; i++) { if (press(c[i]) || vis.size() == 1) { s = c[i]; j = i; vis.erase(i); break; } else { vis.erase(i); } } for (int i = 0; i < 4; i++) { vis.insert(i); } vis.erase(j); while (s.size() < n) { int last = *s.end(); for (int i = 0; i < 4; i++) { if (i == j) { continue; } if (!vis.count(i)) { vis.insert(i); continue; } if (i == last) { s += c[i]; break; } string p = s + c[i] + c[i]; if (press(p) == p.size()) { s = p; break; } else if (press(p) == p.size() - 1) { s += c[i]; vis.erase(i); break; } } } return s; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:36:21: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   36 |     while (s.size() < n) {
      |            ~~~~~~~~~^~~
combo.cpp:51:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   51 |             if (press(p) == p.size()) {
      |                 ~~~~~~~~~^~~~~~~~~~~
combo.cpp:55:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   55 |             else if (press(p) == p.size() - 1) {
      |                      ~~~~~~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...