제출 #297691

#제출 시각아이디문제언어결과실행 시간메모리
297691Leonardo16콤보 (IOI18_combo)C++14
0 / 100
0 ms200 KiB
#include<bits/stdc++.h> #include "combo.h" using namespace std; #define ll long long #define ull unsigned long long #define ld long double #define ii pair<int,int> #define vi vector<int> #define vii vector<ii > #define fst first #define scd second #define sz size #define pb push_back #define fl '\n' #define el endl #define all(x) x.begin(),x.end() string guess_sequence(int n) { char beg='A'; if(press("B")==1){ beg='B'; }else{ if(press("XY")>=1){ if( press("X")==1 ){ beg='X'; }else{ beg='Y'; } } } map<char,int>mp; mp['A']++; mp['B']++; mp['X']++; mp['Y']++; mp.erase(beg); vector<char>v; for(auto it:mp){ v.pb(it.fst); } string ret; ret+=beg; cout<<v[0]<<" "<<v[1]<<" "<<v[2]<<fl; for(int i=2;i<=n;i++){ string ask; for(int j=0;j<ret.sz();j++){ ask+=ret[j]; } ask+=v[0]; if(i!=n){ for(int j=0;j<ret.sz();j++){ ask+=ret[j]; } ask+=v[1]; ask+=v[0]; for(int j=0;j<ret.sz();j++){ ask+=ret[j]; } ask+=v[1]; ask+=v[1]; for(int j=0;j<ret.sz();j++){ ask+=ret[j]; } ask+=v[1]; ask+=v[2]; }else{ string ask; for(int j=0;j<ret.sz();j++){ ask+=ret[j]; } if(press(ask+v[0])==n){ ret+=v[0]; }else{ if(press(ask+v[1])==n){ ret+=v[1]; }else{ ret+=v[2]; } } break; } int x=press(ask); if(x==i){ ret+=v[0]; }else{ if(x==i+1){ ret+=v[1]; }else{ ret+=v[2]; } } cout<<ask<<" "<<x<<fl; cout<<ret<<fl; } return ret; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:60:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   60 |         for(int j=0;j<ret.sz();j++){
      |                     ~^~~~~~~~~
combo.cpp:68:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   68 |             for(int j=0;j<ret.sz();j++){
      |                         ~^~~~~~~~~
combo.cpp:73:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   73 |             for(int j=0;j<ret.sz();j++){
      |                         ~^~~~~~~~~
combo.cpp:78:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   78 |             for(int j=0;j<ret.sz();j++){
      |                         ~^~~~~~~~~
combo.cpp:85:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   85 |             for(int j=0;j<ret.sz();j++){
      |                         ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...