Submission #79155

#TimeUsernameProblemLanguageResultExecution timeMemory
79155patcasraresCombo (IOI18_combo)C++14
5 / 100
2 ms272 KiB
#include<fstream> #include<vector> #include "combo.h" #include<iostream> #define pb push_back using namespace std; string guess_sequence(int n) { int r,poz,cnt=-1; char c[4]={'A','B','X','Y'},a[4]; string p,rez; p="AB"; r=press(p); if(r>0) poz=0; else poz=2; p=c[poz]; r=press(p); if(r==0) poz++; rez.pb(c[poz]); for(int i=0;i<4;i++) if(i!=poz) { cnt++; a[cnt]=c[i]; } for(int i=2;i<n;i++) { string p; for(int j=0;j<rez.size();j++) p.pb(rez[j]); p.pb(a[0]); for(int j=0;j<rez.size();j++) p.pb(rez[j]); p.pb(a[1]); p.pb(a[0]); for(int j=0;j<rez.size();j++) p.pb(rez[j]); p.pb(a[1]); p.pb(a[1]); for(int j=0;j<rez.size();j++) p.pb(rez[j]); p.pb(a[1]); p.pb(a[2]); r=press(p); if(r==i) { rez.pb(a[0]); continue; } if(r==i+1) { rez.pb(a[1]); continue; } rez.pb(a[2]); } string q; for(int j=0;j<rez.size();j++) q.pb(rez[j]); q.pb(a[0]); for(int j=0;j<rez.size();j++) q.pb(rez[j]); q.pb(a[1]); r=press(q); if(r==n) { string p; for(int j=0;j<rez.size();j++) p.pb(rez[j]); p.pb(a[0]); r=press(p); if(r==n) rez.pb(a[0]); else rez.pb(a[1]); } else rez.pb(a[2]); return rez; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:32:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |         for(int j=0;j<rez.size();j++)
      |                     ~^~~~~~~~~~~
combo.cpp:35:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |         for(int j=0;j<rez.size();j++)
      |                     ~^~~~~~~~~~~
combo.cpp:39:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |         for(int j=0;j<rez.size();j++)
      |                     ~^~~~~~~~~~~
combo.cpp:43:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |         for(int j=0;j<rez.size();j++)
      |                     ~^~~~~~~~~~~
combo.cpp:61:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   61 |     for(int j=0;j<rez.size();j++)
      |                 ~^~~~~~~~~~~
combo.cpp:64:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   64 |     for(int j=0;j<rez.size();j++)
      |                 ~^~~~~~~~~~~
combo.cpp:71:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   71 |         for(int j=0;j<rez.size();j++)
      |                     ~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...