# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
298190 | evpipis | Teams (CEOI11_tea) | C++11 | 2594 ms | 17212 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;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> ii;
const int len = 1e6+5, inf = 1e9;
int opt[len], dp[len];
ii arr[len];
int main(){
int n;
scanf("%d", &n);
for (int i = 1; i <= n; i++)
scanf("%d", &arr[i].fi), arr[i].se = i;
sort(arr+1, arr+1+n);
for (int i = 1; i <= n; i++){
dp[i] = -inf;
for (int j = 0; j <= i-arr[i].fi; j++)
if (dp[j] != -inf && dp[j]+1 >= dp[i])
dp[i] = dp[j]+1, opt[i] = j;
}
printf("%d\n", dp[n]);
int i = n;
while (i > 0){
int j = opt[i];
printf("%d", i-j);
while (i > j){
printf(" %d", arr[i].se);
i--;
}
printf("\n");
}
return 0;
}
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... |
# | 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... |