# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
255137 | babo | Teams (CEOI11_tea) | C++14 | 316 ms | 51704 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>
#define L long long
using namespace std;
L n;
struct S{
L a,ord;
}a[1000010];
bool operator<(S a,S b){
return a.a<b.a;
}
L ma[1000010],mad[1000010],bck[1000010];
int main()
{
scanf("%lld",&n);
L i;
for(i=1;i<=n;i++)
{
scanf("%lld",&a[i].a);
a[i].ord=i;
}
sort(a+1,a+n+1);
for(i=1;i<=n;i++)
{
ma[i]=ma[i-1];
mad[i]=mad[i-1];
if(a[i].a>i) continue;
if(ma[i]<=ma[i-a[i].a]+1)
{
ma[i]=ma[i-a[i].a]+1;
mad[i]=i;
bck[i]=mad[i-a[i].a];
}
}
printf("%lld\n",ma[n]);
L temp=n;
while(temp)
{
printf("%lld ",temp-bck[temp]);
for(i=bck[temp]+1;i<=temp;i++)
printf("%lld ",a[i].ord);
puts("");
temp=bck[temp];
}
}
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... |