Submission #1043872

#TimeUsernameProblemLanguageResultExecution timeMemory
1043872Melanie_MenjivarCombo (IOI18_combo)C++14
0 / 100
0 ms344 KiB
#include <bits/stdc++.h> #include "combo.h" // abreviaciones de datos y funciones de ellas #define ll long long #define st string #define p pair #define f first #define s second #define v vector #define pb push_back #define vll vector <long long> #define vst vector<string> #define vpll vector <pair<ll,ll>> #define vvll v<vll> #define as assign #define pll pair<ll,ll> #define matrizll v<vll> #define matrizch v<v<char>> #define itrll vll::iterator #define itrst vst::iterator #define itrpll vpll::iterator #define all(x) x.begin(),x.end() #define pq priority_queue #define pq_ll pq <ll> #define pq_st pq <st> #define pq_pll pq<pll> // abreviaciones funciones de impresion #define espa ' ' #define en '\n' #define coutv(a) for(auto x:a){cout<<x<<en;} #define yes cout<<"YES"<<endl #define no cout<<"NO"<<endl //funciones comunes #define rep(i,a,b) for(int i=a;i<b;i++) #define repm(i,a) for(ll i=a;i>=0;i--) #define test(t) while(t--) #define sort(a) sort(a.begin(),a.end()) #define reverse(a) reverse(a.begin(),a.end()); using namespace std; std::string guess_sequence(int n) { st S; int consu; string letras[3]; rep(i,0,n){ if(i==0){ consu=press("AB"); if(consu==0){ if(press("X")==0){ S+="Y"; letras[0]="A";letras[1]="B";letras[2]="X"; }else{ S+="X"; letras[0]="A";letras[1]="B";letras[2]="Y"; } }else if(consu==1){ if(press("A")==1){ S+="A"; letras[0]="B";letras[1]="X";letras[2]="Y"; }else { S+="B"; letras[0]="A";letras[1]="X";letras[2]="Y"; } }else{ S+="A"; letras[0]="B";letras[1]="X";letras[2]="Y"; } }else if(i==n-1){ consu=press(letras[0]); if(consu==0){ if(press(letras[1])==0){ S+=letras[2]; }else{ S+=letras[1]; } }else{ S+=letras[0]; } }else{ consu=press(S+letras[0]+S+letras[1]+letras[0]+S+letras[1]+letras[1]+S+letras[1]+letras[2]); if(consu==S.size()+1){ S+=letras[0]; }else if(consu==S.size()+2){ S+=letras[1]; }else{ S+=letras[2]; } } } return S; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:95:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   95 |       if(consu==S.size()+1){
      |          ~~~~~^~~~~~~~~~~~
combo.cpp:97:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   97 |       }else if(consu==S.size()+2){
      |                ~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...