Submission #1333859

#TimeUsernameProblemLanguageResultExecution timeMemory
1333859hmms127서열 (APIO23_sequence)C++20
Compilation error
0 ms0 KiB
#include "sequence.h"
#include <vector>
#include "bits/stdc++.h"
using namespace std;
int sequence(int n, vector<int> a) {
    int ans=0;
    for (int l=0;l<n;l++) {
        vector<int>v;vector<int>frq(n+1,0);
        for (int r=l;r<n;r++) {
            v.pb(a[r]);
            frq[a[r]]++;
            sort(v.begin(),v.end());
            if ((r-l+1)%2) {
                ans=max(ans,frq[v[(int)(v.size()/2)]]);
            }
            else ans=max({ans,frq[v[(int)(v.size()/2)]],frq[v[(int)(v.size()/2)-1]]});
        }
    }
    return ans;
}

Compilation message (stderr)

sequence.cpp: In function 'int sequence(int, std::vector<int>)':
sequence.cpp:10:15: error: 'class std::vector<int>' has no member named 'pb'
   10 |             v.pb(a[r]);
      |               ^~