| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 985677 | rembocoder | Volontiranje (COCI21_volontiranje) | C++17 | 1038 ms | 9564 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define int int64_t
// const int mod = 1e9 + 7;
const int inf = 2e18;
int32_t main() {
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
vector<bool> del(n, false);
int ans = -1;
vector<vector<int>> seqs;
while (true) {
vector<int> dp(n, -inf);
for (int i = n - 1; i >= 0; i--) {
if (del[i]) {
continue;
}
dp[i] = 1;
for (int j = i + 1; j < n; j++) {
if (!del[j] && a[j] > a[i]) {
dp[i] = max(dp[i], dp[j] + 1);
}
}
}
int cur = -inf;
for (int i = 0; i < n; i++) {
if (!del[i]) {
cur = max(cur, dp[i]);
}
}
if (ans == -1) {
ans = cur;
} else if (ans != cur) {
break;
}
seqs.push_back({});
int last = -1;
for (int i = 0; i < n; i++) {
if (del[i] || dp[i] != cur || (last != -1 && a[i] <= a[last])) {
continue;
}
last = i;
cur--;
seqs.back().push_back(i);
del[i] = true;
}
}
cout << seqs.size() << ' ' << ans << '\n';
for (int i = 0; i < seqs.size(); i++) {
for (int x: seqs[i]) {
cout << x + 1 << ' ';
}
cout << '\n';
}
}
컴파일 시 표준 에러 (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... | ||||
