# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
443549 |
2021-07-10T18:07:18 Z |
prvocislo |
Teams (CEOI11_tea) |
C++17 |
|
372 ms |
107592 KB |
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
struct kid { int a, i; };
bool cmp(const kid &a, const kid &b) { return a.a > b.a; }
struct nieco { int cnt, mini, pv; };
void upd(nieco &a, const nieco &b)
{
if (b.cnt > a.cnt || (a.cnt == b.cnt && a.mini > b.mini)) a = b;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector<kid> v(n+1);
for (int i = 1; i <= n; i++)
cin >> v[i].a, v[i].i = i;
sort(v.begin()+1, v.end(), cmp);
vector<nieco> dp(n+1);
vector<vector<int> > vj(2*n+5);
dp[v[1].a] = { 1, v[1].a, 0 };
for (int i = v[1].a+1; i <= n; i++)
{
dp[i] = { dp[i-1].cnt, dp[i-1].mini, dp[i-1].pv };
if (dp[i-1].mini * 1ll * dp[i-1].cnt == (ll)i) dp[i].mini++;
for (int j : vj[i+1])
upd(dp[i], { dp[j-1].cnt+1, max(dp[j-1].mini, i-j+1), j-1 });
vj[v[i].a + i].push_back(i);
}
cout << dp[n].cnt << "\n";
int r = n;
while (r)
{
//cout << r << endl;
int l = dp[r].pv;
cout << r - l;
for (int i = l+1; i <= r; i++) cout << " " << v[i].i;
cout << "\n";
r = l;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
716 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
716 KB |
Output is correct |
2 |
Incorrect |
2 ms |
716 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
28 ms |
8280 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
32 ms |
9676 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
274 ms |
82248 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
372 ms |
107592 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
361 ms |
96268 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |