이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "sequence.h"
#include <bits/stdc++.h>
#define range(it, a, b) for (ll it = a; it < b; it++)
#define all(x) begin(x), end(x)
#define ll long long
#define ull unsigned long long
#define INF64 ((ll) 1 << 62)
#define INF32 (1 << 30)
#define mset multiset
#define uset unordered_set
#define umap unordered_map
#define pqueue priority_queue
#define ptr(A) shared_ptr<A>
using namespace std;
int sequence(int N, vector<int> A) {
int maxi = 0;
map<int, int> freq;
range(l, 0, N) {
freq.clear();
range(r, l, N) {
freq[A[r]]++;
int sz = r-l+1;
int a = sz/2, b = a+(sz&1);
int pos = -1;
for (auto& it : freq) {
pos += it.second;
if (pos >= a) {
// cout << it.first << ' '<<it.second<<'\n';
maxi = max(maxi, it.second);
}
if (pos >= b) {
// cout << it.first << ' '<<it.second<<'\n';
maxi = max(maxi, it.second);
break;
}
}
}
}
return maxi;
}
# | 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... |