제출 #654540

#제출 시각아이디문제언어결과실행 시간메모리
654540sofija6콤보 (IOI18_combo)C++14
100 / 100
36 ms572 KiB
#include <bits/stdc++.h> #define ll long long #include "combo.h" using namespace std; string guess_sequence(int N) { string ans="",c="ABXY",a=""; int x=press("AB"); if (x==2) ans+='A'; else if (x) { x=press("A"); if (x) ans+='A'; else ans+='B'; } else { x=press("X"); if (x) ans+='X'; else ans+='Y'; } for (int i=0;i<4;i++) { if (ans[0]!=c[i]) a+=c[i]; } for (ll i=2;i<N;i++) { x=press(ans+a[0]+ans+a[1]+a[0]+ans+a[1]+a[1]+ans+a[1]+a[2]); if (x==i-1) ans+=a[2]; else if (x==i) ans+=a[0]; else ans+=a[1]; } if (ans.size()==N) return ans; x=press(ans+a[0]); if (x==N) return ans+a[0]; x=press(ans+a[1]); if (x==N) return ans+a[1]; return ans+a[2]; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:42:19: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   42 |     if (ans.size()==N)
      |         ~~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...