| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1335477 | killerzaluu | Sequence (APIO23_sequence) | C++20 | 2094 ms | 37524 KiB |
#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;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
int sequence(int N, vector<int> A) {
int i, j;
int ans = 0;
for(i = 0; i < N; i++) {
ordered_set<pair<int,int>> sad;
vector<int> freq(N + 1, 0);
for(j = i; j < N; j++) {
sad.insert({A[j], j});
freq[A[j]]++;
int len = j - i + 1;
auto L = *sad.find_by_order((len - 1) / 2);
auto R = *sad.find_by_order(len / 2);
int x = L.first;
int y = R.first;
ans = max(ans, max(freq[x], freq[y]));
}
}
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... | ||||
