제출 #396899

#제출 시각아이디문제언어결과실행 시간메모리
396899pavement콤보 (IOI18_combo)C++17
0 / 100
1 ms200 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; char rev[4]; string guess_sequence(int N) { rev[0] = 'A'; rev[1] = 'B'; rev[2] = 'X'; rev[3] = 'Y'; int ans = 0; string tmp = "AB", curr; if (press(tmp)) { tmp = "A"; if (press(tmp)) curr = "A"; else curr = "B"; } else { tmp = "X"; if (press(tmp)) curr = "X"; else curr = "Y"; } curr = rev[ans]; vector<char> notans; for (int i = 0; i <= 3; i++) if (i != ans) notans.push_back(rev[i]); for (int i = 1; i < N - 1; i++) { string tmp = curr; tmp += notans[0]; tmp += curr; tmp += notans[1]; tmp += notans[0]; tmp += curr; tmp += notans[1]; tmp += notans[1]; tmp += curr; tmp += notans[1]; tmp += notans[2]; int x = press(tmp); if (x == curr.size() + 1) curr += notans[0]; else if (x == curr.size() + 2) curr += notans[1]; else curr += notans[2]; } for (int i = 0; i < (int)notans.size() - 1; i++) { char c = notans[i]; string tmp = curr; tmp += c; if (press(tmp) == tmp.size()) { curr.push_back(c); break; } } if (curr.size() < N) curr += notans.back(); return curr; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:40:9: 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 (x == curr.size() + 1) curr += notans[0];
      |       ~~^~~~~~~~~~~~~~~~~~
combo.cpp:41:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |   else if (x == curr.size() + 2) curr += notans[1];
      |            ~~^~~~~~~~~~~~~~~~~~
combo.cpp:48:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   48 |   if (press(tmp) == tmp.size()) {
      |       ~~~~~~~~~~~^~~~~~~~~~~~~
combo.cpp:53:18: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   53 |  if (curr.size() < N) curr += notans.back();
      |      ~~~~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...