Submission #954263

#TimeUsernameProblemLanguageResultExecution timeMemory
954263Trisanu_DasSequence (APIO23_sequence)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "sequence.h" using namespace std; int sequence(int n, vector<int> a){ int occ[n + 1], ans = 0; for(int i = 0; i < n; i++){ memset(occ, 0, sizeof(occ)); multiset<int> l, r; for(int j = i; j < n; j++){ occ[a[j]]++; if(r.empty() || A[j] <= *r.begin()) l.insert(A[j]); else r.insert(A[j]); if(l.size() > r.size() + 1){ r.insert(*--l.end()); l.erase(--l.end()); } if(r.size() > l.size()){ l.insert(*r.begin()); r.erase(r.begin()); } ans = max(ans, occ[*--l.end()]); if(l.size() == r.size()) ans = max(ans, occ[*r.begin()]); } } return ans; }

Compilation message (stderr)

sequence.cpp: In function 'int sequence(int, std::vector<int>)':
sequence.cpp:12:23: error: 'A' was not declared in this scope
   12 |       if(r.empty() || A[j] <= *r.begin()) l.insert(A[j]);
      |                       ^