# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
688557 | Alcabel | Art Collections (BOI22_art) | C++17 | 1537 ms | 868 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <art.h>
#include <bits/stdc++.h>
using namespace std;
void solve(int n) {
vector<int> p(n);
iota(p.begin(), p.end(), 1);
vector<int> sorted = {p[0]}, posOf(n);
int was = publish(p);
for (int i = 1; i < n; ++i) {
swap(p[0], p[i]);
int cur = publish(p);
swap(p[0], p[i]);
sorted.emplace_back(p[i]);
posOf[p[i] - 1] = i;
bool isNewGreater = false;
for (int j = i; j >= 0; --j) {
// j is current pos of p[i]
// - posOf[p[0] - 1] - (i - posOf[p[i] - 1]) + isNewGreater
// + (i - posOf[p[0] - 1]) + posOf[p[i] - 1] - (1 - isNewGreater)
if (was - posOf[p[0] - 1] - (i - posOf[p[i] - 1]) + isNewGreater + (i - posOf[p[0] - 1]) + posOf[p[i] - 1] - (1 - isNewGreater) == cur) {
break;
}
assert(j > 0);
if (sorted[j - 1] == p[0]) {
isNewGreater = true;
}
--posOf[p[i] - 1];
++posOf[sorted[j - 1] - 1];
swap(sorted[j - 1], sorted[j]);
}
}
answer(sorted);
}
컴파일 시 표준 에러 (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... |