제출 #862332

#제출 시각아이디문제언어결과실행 시간메모리
862332aykhn콤보 (IOI18_combo)C++14
5 / 100
1 ms500 KiB
#include "combo.h" #include <bits/stdc++.h> // author : aykhn using namespace std; typedef long long ll; #define pb push_back #define ins insert #define mpr make_pair #define all(v) v.begin(), v.end() #define bpc __builtin_popcount #define bpcll __builtin_popcountll #define pii pair<int, int> #define pll pair<ll, ll> #define fi first #define se second #define infll 0x3F3F3F3F3F3F3F3F #define inf 0x3F3F3F3F string guess_sequence(int N) { string res = ""; int x = press("AB"); if (x) { x = press("A"); if (x) res = "A"; else res = "B"; } else { x = press("X"); if (x) res = "X"; else res = "Y"; } string temp = "ABXY"; string ch; for (int i = 0; i < 4; i++) if (temp[i] != res[0]) ch.pb(temp[i]); int prev = 1; for (int i = 1; i + 1 < N; i++) { string s = res; s.pb(ch[0]); s += res; s.pb(ch[1]); s.pb(ch[0]); s += res; s.pb(ch[1]); s.pb(ch[1]); s += res; s.pb(ch[1]); s.pb(ch[2]); x = press(s); if (x == prev) res.pb(ch[2]); else if (x == prev + 1) res.pb(ch[0]); else res.pb(ch[1]); prev++; } res.pb(ch[0]); x = press(res); if (x == res.length()) return res; res.pop_back(); res.pb(ch[1]); x = press(res); if (x == res.length()) return res; res.pop_back(); res.pb(ch[2]); return res; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:63:8: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   63 |  if (x == res.length()) return res;
      |      ~~^~~~~~~~~~~~~~~
combo.cpp:67:8: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   67 |  if (x == res.length()) return res;
      |      ~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...