제출 #1104037

#제출 시각아이디문제언어결과실행 시간메모리
1104037asdfghjk콤보 (IOI18_combo)C++14
0 / 100
3 ms592 KiB
#include <bits/stdc++.h> #define ll long long #define pb push_back #define all(x) x.begin(), x.end() #define F first #define ld long double #define S second using namespace std; const ll N = 5e3 + 5; const ll NN = 4e5 + 5; const ll INF = 1e18; const ll inf = 1e9; const ll MOD = 1e9 + 7; int press(std::string p); string find_second(){ string d = "ABX"; int res = press(d); if(res == 3)return d; if(res == 2){ res = press("AB"); if(res == 2)return "AB"; res = press("AX"); if(res == 2)return "AX"; res = press("BX"); if(res == 2)return "BX"; } if(res == 1){ res = press("AY"); if(res == 2)return "AY"; res = press("BY"); if(res == 2)return "BY"; res = press("XY"); if(res == 2)return "XY"; } res = press("YA"); if(res == 2)return "YA"; res = press("YB"); if(res == 2)return "YB"; res = press("YX"); if(res == 2)return "YX"; } string guess_sequence(int n){ string a = "qwertythjyh"; string s = find_second(); for(int i = 2;i <= n;i++){ if(int(s.size()) > i)continue; string d = s; d += a[1]; d += a[2]; int z = press(d); d = s; d += a[2]; d += a[3]; int x= press(d); if(z == s.size()){ s += a[3]; } else if(x == s.size()){ s += a[1]; } else s += a[2]; } return s; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:55:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   55 |         if(z == s.size()){
      |            ~~^~~~~~~~~~~
combo.cpp:58:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   58 |         else if(x == s.size()){
      |                 ~~^~~~~~~~~~~
combo.cpp: In function 'std::string find_second()':
combo.cpp:16:16: warning: control reaches end of non-void function [-Wreturn-type]
   16 |     string d = "ABX";
      |                ^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...