Submission #592924

#TimeUsernameProblemLanguageResultExecution timeMemory
592924daisy2Combo (IOI18_combo)C++14
100 / 100
34 ms752 KiB
#include "combo.h" #include<string> #include<iostream> using namespace std; string r[6]; std::string guess_sequence(int N) { char let[6]={0,'A','B','X','Y'},c[6]; int firstlet=0,in[6]={0,1,2,3,4}; string now=""; { // first letter if(press("AB")>=1) { if(press("A")==1) {now=now+('A');} else {now=now+('B');swap(in[2],in[1]);} } else{ if(press("X")==1) {now=now+('X');swap(in[3],in[1]);} else {now=now+('Y');swap(in[4],in[1]);} } } int re; for (int i = 1; i < N-1; ++i) { r[1]=now+let[in[2]]+let[in[2]]; r[2]=now+let[in[2]]+let[in[3]]; r[3]=now+let[in[2]]+let[in[4]]; r[4]=now+let[in[3]]; //cout<<r[1]<<endl; r[1]=r[1]+r[2]+r[3]+r[4]; re=press(r[1]); if(re==i+2) now=now+let[in[2]]; else if(re==i+1) now=now+let[in[3]]; else now=now+let[in[4]]; } //cout<<now<<endl; if(N>1){ r[1]=now+let[in[2]]; r[2]=now+let[in[3]]; if(press(r[1]+r[2])==N) { if(press(r[1])==N) return r[1]; return r[2]; } now=now+let[in[4]];} return now; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:8:37: warning: unused variable 'c' [-Wunused-variable]
    8 |     char let[6]={0,'A','B','X','Y'},c[6];
      |                                     ^
combo.cpp:9:9: warning: unused variable 'firstlet' [-Wunused-variable]
    9 |     int firstlet=0,in[6]={0,1,2,3,4};
      |         ^~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...