Submission #129848

#TimeUsernameProblemLanguageResultExecution timeMemory
129848miguelCombo (IOI18_combo)C++14
5 / 100
3 ms316 KiB
#include<bits/stdc++.h> #include <combo.h> using namespace std; #define rc(x) return cout<<x<<endl,0 #define pb push_back #define dbg(x) cout << #x << '=' << x << '\n'; #define ll long long #define sz size() #define x first #define y second #define pi pair <int, int> #define pii pair <int, pi> #define vi vector <int> const ll mod = 1e9 + 7; int n; string guess_sequence(int n){ string s=""; vector <string> ch={"A", "B", "X", "Y"}; if(press("A")) s="A"; else if(press("B")) s="B"; else if(press("X")) s="X"; else s="Y"; vector <string> use; for(int i=0; i<=3; i++) if(ch[i]!=s) use.pb(ch[i]); for(int i=1; i<n-1; i++){ string xd=s+use[0]+s+use[1]+use[0]+s+use[1]+use[1]+s+use[1]+use[2]; int q=press(xd); if(q==s.size()) s=s+use[2]; else if(q==s.size()+1) s=s+use[0]; else s=s+use[1]; } int q=press(s+use[0]+s+use[1]); if(q==s.size()){ return (s+use[2]); } else{ q=press(s+use[0]); if(q==s.size()) return (s+use[1]); else return (s+use[0]); } }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:29:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |         if(q==s.size()) s=s+use[2];
      |            ~^~~~~~~~~~
combo.cpp:30:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |         else if(q==s.size()+1) s=s+use[0];
      |                 ~^~~~~~~~~~~~
combo.cpp:34:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |     if(q==s.size()){
      |        ~^~~~~~~~~~
combo.cpp:39:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |         if(q==s.size()) return (s+use[1]);
      |            ~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...