# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
849865 | MinaRagy06 | Art Collections (BOI22_art) | C++17 | 83 ms | 440 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>
#include "art.h"
#ifdef MINA
#include "sample_grader.cpp"
#endif
using namespace std;
void solve(int n) {
vector<int> a(n);
for (int i = 0; i < n; i++) {
a[i] = i + 1;
}
int done[n + 1]{};
int prv = publish(a);
for (int i = n - 1; i >= 0; i--) {
if (done[a[i]]) continue;
while (i + 1 < n) {
vector<int> lst = a;
swap(a[i], a[i + 1]);
i++;
int cur = publish(a);
if (cur > prv) {
a = lst;
i--;
break;
} else {
prv = cur;
}
}
done[a[i]] = 1;
}
answer(a);
}
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... |