Submission #986398

#TimeUsernameProblemLanguageResultExecution timeMemory
986398PyqeCombo (IOI18_combo)C++17
100 / 100
19 ms2004 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; long long pst[3]; string kyy="ABXY",ky=""; string guess_sequence(int n) { long long i,k,z1; string s,cr; k=!!press("XY"); s=kyy[k*2+1]; z1=k*2+press(s); cr=kyy[z1]; for(i=0;i<4;i++) { if(i==z1) { continue; } pst[ky.length()]=i; ky=ky+kyy[i]; } for(i=2;i<n;i++) { s=cr+ky[1]+cr+ky[2]+ky[0]+cr+ky[2]+ky[1]+cr+ky[2]+ky[2]; cr=cr+kyy[pst[press(s)-i+1]]; } for(i=0;n>1&&i<2;i++) { s=cr+ky[i]; if(press(s)==n) { cr=cr+kyy[pst[i]]; break; } } if(cr.length()<n) { cr=cr+kyy[pst[2]]; } return cr; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:41:16: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   41 |  if(cr.length()<n)
      |     ~~~~~~~~~~~^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...