제출 #138507

#제출 시각아이디문제언어결과실행 시간메모리
138507ckodser콤보 (IOI18_combo)C++14
5 / 100
2 ms340 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]); } } 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(press(p)!=p.size())exit(1); if(p.size()!=i+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:44: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]
   44 |  if(res==p.size()){
      |     ~~~^~~~~~~~~~
combo.cpp:47: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]
   47 |  else if(res==p.size()+1){
      |          ~~~^~~~~~~~~~~~
combo.cpp:50: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]
   50 |  else if(res==p.size()+2){
      |          ~~~^~~~~~~~~~~~
combo.cpp:53:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   53 |  if(press(p)!=p.size())exit(1);
      |     ~~~~~~~~^~~~~~~~~~
combo.cpp:54:13: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   54 |  if(p.size()!=i+1)exit(1);
      |     ~~~~~~~~^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...