Submission #78790

#TimeUsernameProblemLanguageResultExecution timeMemory
78790patcasraresCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include<iostream> #include "combo.h" using namespace std; int press2(string s,int n) { //cout<<s.size()<<' '<<4*n<<'\n'; if(s.size()>4*n) while(1){} return press(s); } string guess_sequence(int N) { int r,poz=0,cnt=-1; string a[3],cand[4]={"A","B","X","Y"}; string q,rez; q="AB"; r=press2(q,n); if(r) poz=0; else poz=2; q=cand[poz]; r=press2(q,n); if(r==0) poz++; for(int i=0;i<4;i++) if(i!=poz) { cnt++; a[cnt]=cand[i]; } rez=cand[poz]; cnt=1; poz=2; for(int i=2;i<n;i++) { q=rez+a[0]+rez+a[1]+a[0]+rez+a[1]+a[1]+rez+a[1]+a[2]; r=press2(q,n); if(r==i-1) { rez=rez+a[2]; continue; } if(r==i) { rez=rez+a[0]; continue; } rez=rez+a[1]; if(press(rez)!=i) while(1){} } q=rez+a[0]+rez+a[1]; r=press2(q,n); if(r==n) { q=rez+a[0]; r=press2(q,n); if(r==n) rez=rez+a[0]; else rez=rez+a[1]; } else rez=rez+a[2]; return rez; }

Compilation message (stderr)

combo.cpp: In function 'int press2(std::string, int)':
combo.cpp:7:16: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
    7 |     if(s.size()>4*n)
      |        ~~~~~~~~^~~~
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:17:16: error: 'n' was not declared in this scope
   17 |     r=press2(q,n);
      |                ^