이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "sequence.h"
#include <bits/stdc++.h>
using namespace std;
int sequence(int N, std::vector<int> A) {
    int mx = 0;
    for (int i = 0; i < N; i++) {
        map<int, int> cnt;
        priority_queue<int> pql;
        priority_queue<int, vector<int>, greater<int>> pqh;
        for (int j = i; j < N; j++) {
            int cur;
            cnt[A[j]]++;
            pqh.push(A[j]);
            if (pqh.size() > pql.size()) {
                int x = pqh.top();
                pqh.pop();
                pql.push(x);
            }
            while (!pqh.empty() && pql.top() > pqh.top()) {
                int x = pql.top();
                pql.pop();
                int y = pqh.top();
                pqh.pop();
                pql.push(y);
                pqh.push(x);
            }
            if (pql.size() == pqh.size() && pql.top() != pqh.top())
                cur = max(cnt[pql.top()], cnt[pqh.top()]);
            else
                cur = cnt[pql.top()];
            mx = max(mx, cur);
        }
    }
    return mx;
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... |