이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "bits/stdc++.h"
#include "sequence.h"
using namespace std;
using ll = long long;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
using namespace __gnu_pbds;
typedef pair<int, int> node;
typedef tree<node, null_type, less<node>, rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
int sequence(int N, std::vector<int> A) {
int n = N;
vector<int> a = A;
int ans = 0;
for (int i = 0; i < n; i++) {
ordered_set setik;
map<int, int> mp;
for (int j = i; j < n; j++) {
setik.insert({a[j], j});
mp[a[j]]++;
int x = (*setik.find_by_order((j - i) / 2)).first;
ans = max(ans, mp[x]);
if ((j - i + 1) % 2 == 0) {
int x = (*setik.find_by_order((j - i) / 2 + 1)).first;
ans = max(ans, mp[x]);
}
}
}
return ans;
}
# | 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... |