이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e6 + 10;
pair<int,int> a[maxn];
bool mark[maxn];
int main(){
ios_base::sync_with_stdio(false);
int n;
cin >> n;
for (int i = 1; i <= n; i++){
int x;
cin >> x;
a[i] = {x, i};
}
sort(a + 1, a + n + 1);
int t = 0;
int now = n;
while (now >= 1){
if (a[now].first > now){
now --;
continue;
}
mark[now] = 1;
t ++;
now -= a[now].first;
}
cout << t << endl;
int last = 0;
for (int i = 1; i <= n; i++){
if (mark[i]){
cout << i - last << ' ';
for (int j = last + 1; j <= i; j++)
cout << a[j].second << ' ';
last = i;
cout << '\n';
}
}
}
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |