# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
211475 |
2020-03-20T13:08:04 Z |
Andrei_Cotor |
Teams (CEOI11_tea) |
C++11 |
|
332 ms |
32376 KB |
#include<iostream>
#include<algorithm>
using namespace std;
int Prv[1000005],Best[1000005],Dp[1000005];
pair<int,int> A[1000005];
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n;
cin>>n;
for(int i=1; i<=n; i++)
{
cin>>A[i].first;
A[i].second=i;
}
sort(A+1,A+n+1); //pax din echipe o sa fie pe pozitii consecutive
Dp[0]=0;
Best[0]=0;
for(int i=1; i<=n; i++)
{
Best[i]=Best[i-1];
if(i<A[i].first)
{
Dp[i]=-1000000000;
continue;
}
Dp[i]=1+Dp[Best[i-A[i].first]];
Prv[i]=Best[i-A[i].first];
if(Dp[i]>=Dp[Best[i]])
Best[i]=i;
}
cout<<Dp[n]<<"\n";
int poz=n;
while(poz!=0)
{
cout<<poz-Prv[poz]<<" ";
for(int i=poz; i>Prv[poz]; i--)
cout<<A[i].second<<" ";
cout<<"\n";
poz=Prv[poz];
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
384 KB |
Output is correct |
3 |
Incorrect |
4 ms |
384 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
512 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
512 KB |
Output is correct |
2 |
Incorrect |
6 ms |
512 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
30 ms |
2808 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
31 ms |
3192 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
216 ms |
23852 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
320 ms |
32376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
332 ms |
32120 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |