이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ordered_multiset tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
int sequence(int n, std::vector<int> a) {
int ans = 0;
for(int i = 0; i < n; i++){
ordered_multiset st;
for(int j = i; j < n; j++){
st.insert(a[j]);
int len = j - i + 1;
int f = *st.find_by_order((len - 1) / 2);
int s = *st.find_by_order(len / 2);
ans = max(ans, (int)st.order_of_key(f + 1) - (int)st.order_of_key(f));
ans = max(ans, (int)st.order_of_key(s + 1) - (int)st.order_of_key(s));
}
}
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... |