101622024-03-28 21:59:22111Mágikus sorozatcpp17Partially correct 40/10067ms36812 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;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Partially correct3ms1828 KiB
2Partially correct4ms2480 KiB
subtask26/15
3Partially correct3ms2444 KiB
4Partially correct3ms2672 KiB
5Partially correct3ms2908 KiB
subtask36/15
6Accepted3ms2968 KiB
7Partially correct3ms3180 KiB
8Partially correct3ms3268 KiB
9Partially correct3ms3400 KiB
10Accepted3ms3620 KiB
subtask412/30
11Partially correct3ms4040 KiB
12Partially correct3ms3972 KiB
13Partially correct3ms3996 KiB
14Accepted3ms3960 KiB
subtask516/40
15Partially correct54ms13864 KiB
16Partially correct56ms14764 KiB
17Partially correct54ms15424 KiB
18Partially correct54ms16120 KiB
19Partially correct57ms17328 KiB
20Partially correct59ms18524 KiB
21Partially correct59ms19880 KiB
22Partially correct59ms21152 KiB
23Partially correct59ms22464 KiB
24Partially correct52ms23312 KiB
25Partially correct54ms24148 KiB
26Partially correct57ms25480 KiB
27Accepted46ms27016 KiB
28Partially correct56ms31500 KiB
29Partially correct54ms32152 KiB
30Accepted67ms34296 KiB
31Accepted61ms35868 KiB
32Partially correct57ms36812 KiB