제출 #975279

#제출 시각아이디문제언어결과실행 시간메모리
975279ShaShi콤보 (IOI18_combo)C++17
5 / 100
1 ms600 KiB
#include "combo.h" #include <bits/stdc++.h> #define F first #define S second #define pii pair<int, int> #define all(x) x.begin(), x.end() #define mp make_pair #define pb push_back using namespace std; typedef long long ll; typedef long double ld; const int MAX = (int)2e3 + 7; const int MOD = 998244353; const int INF = (int)1e9 + 7; string guess_sequence(int N) { string res, s, op; res = ""; int x = press("AB"); if (x) { x = press("A"); if (x) res.pb('A'); else res.pb('B'); } else { x = press("X"); if (x) res.pb('X'); else res.pb('Y'); } s = ""; if (res[0] != 'A') s.pb('A'); if (res[0] != 'B') s.pb('B'); if (res[0] != 'X') s.pb('X'); if (res[0] != 'Y') s.pb('Y'); while (res.size() != N-1) { op.clear(); op.pb(res[0]); op.pb(s[0]); op.pb(res[0]); op.pb(s[1]); op.pb(s[0]); op.pb(res[0]); op.pb(s[1]); op.pb(s[1]); op.pb(res[0]); op.pb(s[1]); op.pb(s[2]); x = press(op); if (x == res.size()) { res.pb(s[2]); } else if (x == res.size()+1) { res.pb(s[0]); } else { res.pb(s[1]); } } res.pb(s[0]); x = press(res); if (x == N) return res; res.pop_back(); res.pb(s[1]); x = press(res); if (x == N) return res; res.pop_back(); res.pb(s[2]); return res; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:52:20: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   52 |  while (res.size() != N-1) {
      |         ~~~~~~~~~~~^~~~~~
combo.cpp:61:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   61 |   if (x == res.size()) {
      |       ~~^~~~~~~~~~~~~
combo.cpp:63:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   63 |   } else if (x == res.size()+1) {
      |              ~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...