제출 #165501

#제출 시각아이디문제언어결과실행 시간메모리
165501qwerty234콤보 (IOI18_combo)C++14
100 / 100
47 ms820 KiB
#include <combo.h> #include <bits/stdc++.h> #define ll long long #define ull unsigned ll #define ld long double #define pll pair<ll, ll> #define pii pair<int, int> #define f first #define se second #define pb push_back #define ft fflush(stdout) using namespace std; const int N = 4e5 + 123; const int PLS = 3e5 + 123; string guess_sequence(int n) { int ans; vector <string> psb; psb.clear(); string cur = ""; ans = press("AB"); if (ans == 2) { cur = "A"; psb.pb("B"); psb.pb("X"); psb.pb("Y"); } else if (ans == 1) { ans = press("A"); if (ans == 1) { cur = "A"; psb.pb("B"); psb.pb("X"); psb.pb("Y"); } else { cur = "B"; psb.pb("A"); psb.pb("X"); psb.pb("Y"); } } else { ans = press("X"); if (ans == 1) { cur = "X"; psb.pb("A"); psb.pb("B"); psb.pb("Y"); } else { cur = "Y"; psb.pb("A"); psb.pb("B"); psb.pb("X"); } } string t1, t2, t3, t4; t1 = psb[0]; t2 = psb[1] + psb[0]; t3 = psb[1] + psb[1]; t4 = psb[1] + psb[2]; for (int i = 2; i <= n - 1; i++) { ans = press(cur + t1 + cur + t2 + cur + t3 + cur + t4); if (ans == cur.size()) { cur += psb[2]; } else if (ans == cur.size() + 1) { cur += psb[0]; } else { cur += psb[1]; } } if (n != 1) { ans = press(cur + psb[0]); if (ans == cur.size() + 1) { cur += psb[0]; } else { ans = press(cur + psb[1]); if (ans == cur.size() + 1) cur += psb[1]; else cur += psb[2]; } } return cur; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:66:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   66 |         if (ans == cur.size()) {
      |             ~~~~^~~~~~~~~~~~~
combo.cpp:68:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   68 |         } else if (ans == cur.size() + 1) {
      |                    ~~~~^~~~~~~~~~~~~~~~~
combo.cpp:76:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   76 |         if (ans == cur.size() + 1) {
      |             ~~~~^~~~~~~~~~~~~~~~~
combo.cpp:80:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   80 |             if (ans == cur.size() + 1)
      |                 ~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...