제출 #933842

#제출 시각아이디문제언어결과실행 시간메모리
933842emad234콤보 (IOI18_combo)C++17
0 / 100
0 ms344 KiB
#include <bits/stdc++.h> #define ll long long #define F first #define S second #define pii pair<int,int> const int mod = 1e9 + 7; const int mxN = 2e5 + 5; using namespace std; int press(std::string p); string guess_sequence(int N) { string s = ""; int x = press("XY"); if(x == 2) s += "XY"; else if(x == 1){ if(press("X") == 1) s += "X"; else s += "Y"; }else{ if(press("A") == 1) s += "A"; else s += "B"; } string a = "A",b = "B",c = "X"; char a1 = 'A',b1 = 'B',c1 = 'X'; if(s[0] == a1) a = "Y"; if(s[0] == b1) b = "Y"; if(s[0] == c1) c = "Y"; for(int i = s.size();i < N;i++){ if(i == N - 1){ int x = press(s + a + s + b); if(x == s.size() + 1){ if(press(s + a) == s.size() + 1) s += a; else s += b; } else s += c; break; } string S = s + a + s + b + a + s + b + b + s + b + c; cout<<S<<'\n'; x = press(S); if(x == s.size()) { s += c; } else if(x == s.size() + 1) s += a; else s += b; } return s; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:34:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |    if(x == s.size() + 1){
      |       ~~^~~~~~~~~~~~~~~
combo.cpp:35:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |     if(press(s + a) == s.size() + 1) s += a;
      |        ~~~~~~~~~~~~~^~~~~~~~~~~~~~~
combo.cpp:44:8: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |   if(x == s.size()) {
      |      ~~^~~~~~~~~~~
combo.cpp:47:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   47 |   else if(x == s.size() + 1) s += a;
      |           ~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...