Submission #414073

#TimeUsernameProblemLanguageResultExecution timeMemory
414073arnevesCombo (IOI18_combo)C++17
5 / 100
1 ms328 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; typedef long long ll; #define pb push_back #define f first #define s second #define all(x) x.begin(), x.end() const int MOD = 1'000'000'007; const int MX = 400'005; //long double PI = 3.14159265358979323846264338327950; const string k="ABXY"; int pergunta(string s){ int ans=0; int r=press(s+k[0]+s+k[1]); if(r==s.length())ans+=2; r=press(s+k[0]+s+k[2]); if(r==s.length())ans+=1; return ans; } string guess_sequence(int N) { int id[4]; string ans; for(int i=0; i<4; i++) id[i]=i; int y=pergunta(""); ans+=k[y]; swap(id[y],id[3]); for(int i=1; i<N-1; i++){ string perg; perg+=ans+k[id[1]]; perg+=ans+k[id[2]]+k[id[0]]; perg+=ans+k[id[2]]+k[id[1]]; perg+=ans+k[id[2]]+k[id[2]]; y=press(perg); if(y==ans.length()){ ans+=k[id[0]]; }else if(y==ans.length()+1){ ans+=k[id[1]]; }else{ ans+=k[id[2]]; } } y=pergunta(ans); ans+=k[y]; return ans; }

Compilation message (stderr)

combo.cpp: In function 'int pergunta(std::string)':
combo.cpp:22:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |     if(r==s.length())ans+=2;
      |        ~^~~~~~~~~~~~
combo.cpp:24:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |     if(r==s.length())ans+=1;
      |        ~^~~~~~~~~~~~
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:42:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |         if(y==ans.length()){
      |            ~^~~~~~~~~~~~~~
combo.cpp:44:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |         }else if(y==ans.length()+1){
      |                  ~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...