Submission #1249497

#TimeUsernameProblemLanguageResultExecution timeMemory
1249497ammakaCombo (IOI18_combo)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define pb push_back int press(string p); std::string guess_sequence(int N) { int n=N; vector <string> ve; ve.pb("X"); ve.pb("Y"); ve.pb("A"); ve.pb("B"); int flg=press("XY"); string pr; if(flg){ int flg=press("X"); if(flg){ pr="X"; }else{ pr="Y"; } }else{ int flg=press("A"); if(flg){ pr="A"; }else{ pr="B"; } } ve.erase(find(ve.begin(),ve.end(),pr)); for(int i=2;i<n;i++){ int flg=press(pr+ve[0]+pr+ve[1]+ve[0]+pr+ve[1]+ve[2]+pr+ve[1]+ve[1]); if(flg==i-1){ pr+=ve[2]; }else if(flg==i){ pr+=ve[0]; }else if(flg==i+1){ pr+=ve[1]; } } int flg=press(pr+ve[0]); if(flg==n){ return pr+ve[0]; } int flg=press(pr+ve[1]); if(flg==n){ return pr+ve[1]; }else{ return pr+ve[2]; } }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:41:9: error: redeclaration of 'int flg'
   41 |     int flg=press(pr+ve[0]);
      |         ^~~
combo.cpp:13:9: note: 'int flg' previously declared here
   13 |     int flg=press("XY");
      |         ^~~
combo.cpp:45:9: error: redeclaration of 'int flg'
   45 |     int flg=press(pr+ve[1]);
      |         ^~~
combo.cpp:13:9: note: 'int flg' previously declared here
   13 |     int flg=press("XY");
      |         ^~~