# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
867676 | TAhmed33 | Art Collections (BOI22_art) | C++17 | 608 ms | 1484 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#include "art.h"
vector <int> arr;
void merge (int l, int r) {
if (l == r) return;
int m = (l + r) / 2;
merge(l, m); merge(m + 1, r);
int x = publish(arr);
int p1 = l, p2 = m + 1;
vector <int> ans;
while (p1 <= m && p2 <= r) {
swap(arr[p1], arr[p2]);
int u = publish(arr);
if (u > x) {
swap(arr[p1], arr[p2]);
ans.push_back(arr[p1++]);
} else {
swap(arr[p1], arr[p2]);
ans.push_back(arr[p2++]);
x = u;
}
}
while (p1 <= m) ans.push_back(arr[p1++]);
while (p2 <= r) ans.push_back(arr[p2++]);
for (int i = l; i <= r; i++) arr[i] = ans[i - l];
}
void solve (int n) {
for (int i = 1; i <= n; i++) arr.push_back(i);
merge(0, n - 1);
answer(arr);
}
Compilation message (stderr)
# | 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... |