Submission #467865

#TimeUsernameProblemLanguageResultExecution timeMemory
467865imas_713_aCombo (IOI18_combo)C++14
5 / 100
1 ms200 KiB
# include <bits/stdc++.h> using namespace std; # define ll long long # define ld long double # define pb push_back # define pob pop_back # define mp make_pair # define fi first # define se second # define all(x) x.begin(),x.end() # define ts to_string # define ti(a) atoi(a.c_str()) # define NumAfterDecimalP(x) cout<<setprecision(x)<<fixed const ld pi = 2*acos(0.0); const ll inf = LLONG_MAX; const ll mod = 1e9+7; #include "combo.h" std::string guess_sequence(int N) { string ans; ll c1=press("AB"); bool a=true,b=true,x=true,y=true; if(c1>0){ ll t=press("A"); if(t==1){ ans+="A"; a=false; } else{ ans+="B"; b=false; } } else{ ll t=press("X"); if(t==1){ ans+="X"; x=false; } else{ ans+="Y"; y=false; } } for(int i=2; i<N; i++){ if(a && b && x){ string p; p=ans+"A"+ans+"BB"+ans+"BX"+ans+"BA"; ll ch=press(p); if(ch==ans.size()) ans+="X"; else if(ch==ans.size()+1) ans+="A"; else ans+="B"; } else if(a && b && !x){ string p; p=ans+"A"+ans+"BB"+ans+"BY"+ans+"BA"; ll ch=press(p); if(ch==ans.size()) ans+="Y"; else if(ch==ans.size()+1) ans+="A"; else ans+="B"; } else if(a && !b && x){ string p; p=ans+"A"+ans+"YY"+ans+"YX"+ans+"YA"; ll ch=press(p); if(ch==ans.size()) ans+="X"; else if(ch==ans.size()+1) ans+="A"; else ans+="Y"; } else{ string p; p=ans+"Y"+ans+"BB"+ans+"BX"+ans+"BY"; ll ch=press(p); if(ch==ans.size()) ans+="X"; else if(ch==ans.size()+1) ans+="Y"; else ans+="B"; } } if(!a){ string kj=ans+"B"+ans; ll po=press(kj); if(po==N) return ans+"B"; else{ string kj2=ans+"X"+ans; ll po2=press(kj2); if(po2==N) return ans+"X"; return ans+"Y"; } } else if(!b){ string kj=ans+"A"+ans; ll po=press(kj); if(po==N) return ans+"A"; else{ string kj2=ans+"X"+ans; ll po2=press(kj2); if(po2==N) return ans+"X"; return ans+"Y"; } } else if(!x){ string kj=ans+"B"+ans; ll po=press(kj); if(po==N) return ans+"B"; else{ string kj2=ans+"A"+ans; ll po2=press(kj2); if(po2==N) return ans+"A"; return ans+"Y"; } } else{ string kj=ans+"B"+ans; ll po=press(kj); if(po==N) return ans+"B"; else{ string kj2=ans+"X"+ans; ll po2=press(kj2); if(po2==N) return ans+"X"; return ans+"A"; } } }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:53:11: 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]
   53 |      if(ch==ans.size()) ans+="X";
      |         ~~^~~~~~~~~~~~
combo.cpp:54:16: 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]
   54 |      else if(ch==ans.size()+1) ans+="A";
      |              ~~^~~~~~~~~~~~~~
combo.cpp:62:11: 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]
   62 |      if(ch==ans.size()) ans+="Y";
      |         ~~^~~~~~~~~~~~
combo.cpp:63:16: 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]
   63 |      else if(ch==ans.size()+1) ans+="A";
      |              ~~^~~~~~~~~~~~~~
combo.cpp:71:11: 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]
   71 |      if(ch==ans.size()) ans+="X";
      |         ~~^~~~~~~~~~~~
combo.cpp:72:16: 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]
   72 |      else if(ch==ans.size()+1) ans+="A";
      |              ~~^~~~~~~~~~~~~~
combo.cpp:80:11: 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]
   80 |      if(ch==ans.size()) ans+="X";
      |         ~~^~~~~~~~~~~~
combo.cpp:81:16: 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]
   81 |      else if(ch==ans.size()+1) ans+="Y";
      |              ~~^~~~~~~~~~~~~~
combo.cpp:25:28: warning: variable 'y' set but not used [-Wunused-but-set-variable]
   25 |  bool a=true,b=true,x=true,y=true;
      |                            ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...