5144 | 2023-04-20 07:29:27 | anon | Mágikus sorozat | cpp17 | Wrong answer 15/100 | 143ms | 31616 KiB |
#include <vector>
#include <iostream>
using ll = long long;
using namespace std;
int main()
{
ll i, j, k, N;
cin >> N;
vector<ll> z(N + 1);
for(i = 1; i <= N; i++)
cin >> z[i];
vector<ll> a(N + 1);
a[1] = 1;
i = 2;
j = 0;
while(i <= N)
{
if(z[i])
{
j = i;
k = z[i];
for(;i < j + k; i++)
a[i] = a[i - j + 1];
}
else
{
a[i] = 2;
if(j)
{
while(a[i] == a[i - j + 1]) a[i]++;
j = 0;
}
i++;
}
}
for(i = 1; i <= N; i++)
cout << a[i] << ' ';
cout << endl;
return 0;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1808 KiB | ||||
2 | Accepted | 6ms | 2476 KiB | ||||
subtask2 | 15/15 | ||||||
3 | Accepted | 4ms | 2468 KiB | ||||
4 | Accepted | 3ms | 2440 KiB | ||||
5 | Accepted | 3ms | 2708 KiB | ||||
subtask3 | 0/15 | ||||||
6 | Accepted | 3ms | 2772 KiB | ||||
7 | Accepted | 3ms | 2988 KiB | ||||
8 | Accepted | 3ms | 3208 KiB | ||||
9 | Accepted | 2ms | 3288 KiB | ||||
10 | Wrong answer | 2ms | 3292 KiB | ||||
subtask4 | 0/30 | ||||||
11 | Wrong answer | 4ms | 3552 KiB | ||||
12 | Accepted | 4ms | 3828 KiB | ||||
13 | Wrong answer | 3ms | 4040 KiB | ||||
14 | Wrong answer | 3ms | 4000 KiB | ||||
subtask5 | 0/40 | ||||||
15 | Accepted | 90ms | 14100 KiB | ||||
16 | Wrong answer | 92ms | 14492 KiB | ||||
17 | Wrong answer | 96ms | 15212 KiB | ||||
18 | Wrong answer | 98ms | 16140 KiB | ||||
19 | Wrong answer | 108ms | 17284 KiB | ||||
20 | Wrong answer | 115ms | 18564 KiB | ||||
21 | Wrong answer | 119ms | 20184 KiB | ||||
22 | Wrong answer | 115ms | 21360 KiB | ||||
23 | Wrong answer | 119ms | 22888 KiB | ||||
24 | Wrong answer | 94ms | 23528 KiB | ||||
25 | Wrong answer | 98ms | 24420 KiB | ||||
26 | Wrong answer | 108ms | 25508 KiB | ||||
27 | Wrong answer | 82ms | 25092 KiB | ||||
28 | Accepted | 97ms | 26984 KiB | ||||
29 | Accepted | 93ms | 27680 KiB | ||||
30 | Accepted | 143ms | 29556 KiB | ||||
31 | Accepted | 119ms | 30836 KiB | ||||
32 | Accepted | 101ms | 31616 KiB |