249852026-02-17 11:12:14linhnkZenelejátszó (35 pont)cpp17Accepted 35/35134ms1956 KiB
#include <bits/stdc++.h>
using namespace std;

int main() { //legfeljebb t-ig hallgathatjuk, hogy tovabblepjunk
	int n, a, aprev=0; cin>>n;
	map<int, int> cnt;
	queue<int> q;
	for(int i=0; i<n; i++){
		cin>>a;
		cnt[a-aprev]++;
		aprev=a;
	}
	int skip=1;
	q.push(1);
	for(auto x:cnt){
		skip+=x.second;
		q.push(skip);
	}
	cout<<q.size()<<"\n";
	while(!q.empty()){
		cout<<q.front()<<" ";
		q.pop();
	}
}
SubtaskSumTestVerdictTimeMemory
base35/35
1Accepted0/01ms316 KiB
2Accepted0/08ms496 KiB
3Accepted2/21ms316 KiB
4Accepted2/21ms508 KiB
5Accepted2/22ms316 KiB
6Accepted2/22ms316 KiB
7Accepted2/22ms316 KiB
8Accepted2/22ms316 KiB
9Accepted2/218ms1356 KiB
10Accepted2/243ms1956 KiB
11Accepted2/220ms404 KiB
12Accepted2/279ms400 KiB
13Accepted2/275ms316 KiB
14Accepted1/190ms408 KiB
15Accepted2/2107ms564 KiB
16Accepted2/2134ms1588 KiB
17Accepted2/2134ms1484 KiB
18Accepted2/2134ms1404 KiB
19Accepted2/2134ms1524 KiB
20Accepted2/275ms1844 KiB