제출 #795830

#제출 시각아이디문제언어결과실행 시간메모리
795830gagik_2007콤보 (IOI18_combo)C++17
100 / 100
24 ms584 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> pii; typedef pair<ll, ll> pll; #define ff first #define ss second ll ttt; const ll INF=1e18; const ll MOD=1e9+7; const ll N=5007; ll n,m,k; string guess_sequence(int NN) { n=NN; string pf=""; if(press("AB")){ if(press("A"))pf="A"; else pf="B"; } else if(press("X"))pf+="X"; else pf+="Y"; if(n==1)return pf; vector<char>rem; for(char c:{'A','B','X','Y'}){ if(c!=pf[0])rem.push_back(c); } for(int _=0;_<n-2;_++){ string cur=""; cur+=pf+rem[0]+rem[0]; cur+=pf+rem[0]+rem[1]; cur+=pf+rem[0]+rem[2]; cur+=pf+rem[1]; int res=press(cur); if(res==pf.size())pf+=rem[2]; else if(res==pf.size()+1)pf+=rem[1]; else pf+=rem[0]; } if(press(pf+rem[0])==pf.size()+1)pf+=rem[0]; else if(press(pf+rem[1])==pf.size()+1)pf+=rem[1]; else pf+=rem[2]; return pf; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:40:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |         if(res==pf.size())pf+=rem[2];
      |            ~~~^~~~~~~~~~~
combo.cpp:41:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |         else if(res==pf.size()+1)pf+=rem[1];
      |                 ~~~^~~~~~~~~~~~~
combo.cpp:44:24: 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(press(pf+rem[0])==pf.size()+1)pf+=rem[0];
      |        ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
combo.cpp:45:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   45 |     else if(press(pf+rem[1])==pf.size()+1)pf+=rem[1];
      |             ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...