10162 | 2024-03-28 21:59:22 | 111 | Mágikus sorozat | cpp17 | Partially correct 40/100 | 67ms | 36812 KiB |
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int N;
cin>>N;
vector<int>v(N);
for(int i=0;i<N;i++){
cin>>v[i];
}
v[0]=0;
vector<int>w(N);
deque<int>s;
int x=0;
for(int i=0;i<N;i++){
s.push_back(i);
while(!s.empty()&&s.front()+v[s.front()]<=i){
s.pop_front();
}
w[i]=s.empty()?++x:w[i-s.front()];
cout<<w[i]<<' ';
}
cout<<'\n';
return 0;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Partially correct | 3ms | 1828 KiB | ||||
2 | Partially correct | 4ms | 2480 KiB | ||||
subtask2 | 6/15 | ||||||
3 | Partially correct | 3ms | 2444 KiB | ||||
4 | Partially correct | 3ms | 2672 KiB | ||||
5 | Partially correct | 3ms | 2908 KiB | ||||
subtask3 | 6/15 | ||||||
6 | Accepted | 3ms | 2968 KiB | ||||
7 | Partially correct | 3ms | 3180 KiB | ||||
8 | Partially correct | 3ms | 3268 KiB | ||||
9 | Partially correct | 3ms | 3400 KiB | ||||
10 | Accepted | 3ms | 3620 KiB | ||||
subtask4 | 12/30 | ||||||
11 | Partially correct | 3ms | 4040 KiB | ||||
12 | Partially correct | 3ms | 3972 KiB | ||||
13 | Partially correct | 3ms | 3996 KiB | ||||
14 | Accepted | 3ms | 3960 KiB | ||||
subtask5 | 16/40 | ||||||
15 | Partially correct | 54ms | 13864 KiB | ||||
16 | Partially correct | 56ms | 14764 KiB | ||||
17 | Partially correct | 54ms | 15424 KiB | ||||
18 | Partially correct | 54ms | 16120 KiB | ||||
19 | Partially correct | 57ms | 17328 KiB | ||||
20 | Partially correct | 59ms | 18524 KiB | ||||
21 | Partially correct | 59ms | 19880 KiB | ||||
22 | Partially correct | 59ms | 21152 KiB | ||||
23 | Partially correct | 59ms | 22464 KiB | ||||
24 | Partially correct | 52ms | 23312 KiB | ||||
25 | Partially correct | 54ms | 24148 KiB | ||||
26 | Partially correct | 57ms | 25480 KiB | ||||
27 | Accepted | 46ms | 27016 KiB | ||||
28 | Partially correct | 56ms | 31500 KiB | ||||
29 | Partially correct | 54ms | 32152 KiB | ||||
30 | Accepted | 67ms | 34296 KiB | ||||
31 | Accepted | 61ms | 35868 KiB | ||||
32 | Partially correct | 57ms | 36812 KiB |