제출 #138510

#제출 시각아이디문제언어결과실행 시간메모리
138510ckodser콤보 (IOI18_combo)C++14
100 / 100
69 ms648 KiB
#include "combo.h" #include<bits/stdc++.h> #define ll long long #define pb push_back #define ld long double #define F first #define S second #define mp make_pair #define pii pair<ll,ll> using namespace :: std; const ll maxn=1e5+500; const ll inf=1e9+900; const string d[4]={"A","B","X","Y"}; vector<string> t; string findNext(string s){ ll res01=press(s+d[0]+s+d[1]); ll res02=press(s+d[0]+s+d[2]); if(res01>=s.size()+1){ if(res02>=s.size()+1){ return d[0]; }else{ return d[1]; } }else{ if(res02>=s.size()+1){ return d[2]; }else{ return d[3]; } } } string guess_sequence(int N) { string p = findNext(""); for(ll i=0;i<4;i++){ if(d[i]!=p){ t.pb(d[i]); } } if(N==1)return p; for(ll i=1;i<N-1;i++){ ll res=press(p+t[1]+p+t[2]+t[0]+p+t[2]+t[1]+p+t[2]+t[2]); if(res==p.size()){ p+=t[0]; } else if(res==p.size()+1){ p+=t[1]; } else if(res==p.size()+2){ p+=t[2]; } } if(p.size()!=N-1){ exit(1); } p+=findNext(p); return p; }

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

combo.cpp: In function 'std::string findNext(std::string)':
combo.cpp:21:13: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |     if(res01>=s.size()+1){
      |        ~~~~~^~~~~~~~~~~~
combo.cpp:22:10: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |  if(res02>=s.size()+1){
      |     ~~~~~^~~~~~~~~~~~
combo.cpp:28:10: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |  if(res02>=s.size()+1){
      |     ~~~~~^~~~~~~~~~~~
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:45:8: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   45 |  if(res==p.size()){
      |     ~~~^~~~~~~~~~
combo.cpp:48:13: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   48 |  else if(res==p.size()+1){
      |          ~~~^~~~~~~~~~~~
combo.cpp:51:13: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   51 |  else if(res==p.size()+2){
      |          ~~~^~~~~~~~~~~~
combo.cpp:55:16: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   55 |     if(p.size()!=N-1){
      |        ~~~~~~~~^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...