1
class TopVotedCandidate {4
vector<int> glob_times;5
TopVotedCandidate(vector<int> &persons, vector<int> ×) {10
int sz = persons.size();11
cnt.resize(sz + 1, 0);15
int maxi_person = persons[0];16
for (int i = 1; i < n; i++) {18
if (cnt[persons[i]] > maxi) {19
maxi = cnt[persons[i]];20
maxi_person = persons[i];21
} else if (cnt[persons[i]] == maxi) {22
maxi_person = persons[i];25
pref[i] = maxi_person;30
int it = upper_bound(glob_times.begin(), glob_times.end(), t) - glob_times.begin();37
* Your TopVotedCandidate object will be instantiated and called as such:38
* TopVotedCandidate* obj = new TopVotedCandidate(persons, times);39
* int param_1 = obj->q(t);