Submission #130192

#TimeUsernameProblemLanguageResultExecution timeMemory
130192miguelCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #include <combo.h> using namespace std; #define rc(x) return cout<<x<<endl,0 #define pb push_back #define dbg(x) cout << #x << '=' << x << '\n'; #define ll long long #define sz size() #define x first #define y second #define pi pair <int, int> #define pii pair <int, pi> #define vi vector <int> const ll mod = 1e9 + 7; string guess_sequence(int n){ string s=""; char use[4]; vector <char> ch={'A', 'B', 'X', 'Y'}; if(press("AB")){ if(press("A")){ s+='A'; } else{ s+='B'; } } else{ if(press("X")){ s+='X'; } else{ s+='Y'; } } // cout<<s<<endl; vector <char> use; int q=0; for(int i=0; i<=3; i++){ if(ch[i]!=s[0]) use[q]=ch[i], q++; } //for(string i: use) cout<<"x"<<i<<endl; string xd=""; for(int i=1; i<n-1; i++){ xd=(s+use[0]+s+use[1]+use[0]+s+use[1]+use[1]+s+use[1]+use[2]); // cout<<s<<" "<<xd;//<<endl; q=press(xd); //cout<<" "<<q<<endl; if(q==i+2) s+=use[1]; else if(q==i+1) s+=use[0]; else s+=use[2]; //cout<<s<<endl; }//cout<<s<<endl; if(press(s+use[0])==n){ return s+use[0]; } if(press(s+use[1])==n){ return s+use[1]; } return s+use[2]; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:37:19: error: conflicting declaration 'std::vector<char> use'
   37 |     vector <char> use;
      |                   ^~~
combo.cpp:18:10: note: previous declaration as 'char use [4]'
   18 |     char use[4];
      |          ^~~