238782026-01-31 12:34:51abcdZenelejátszó (35 pont)cpp17Accepted 35/35130ms2128 KiB
#include <bits/stdc++.h>
using namespace std;
using pii=pair<int, int>;

int main() {
    int n;cin>>n;
    map<int,int> cnt;
    int prev=0;
    for(int i=0;i<n;i++){
        int t;cin>>t;
        cnt[t-prev]++;
        prev=t;
    }
    vector<int> ans;
    int pref=1;
    for(auto p:cnt){
        ans.push_back(pref);
        pref+=cnt[p.first];
    }
    ans.push_back(n+1);
    cout<<ans.size()<<'\n';
    for(int x:ans)cout<<x<<' ';
    cout<<'\n';
}
SubtaskSumTestVerdictTimeMemory
base35/35
1Accepted0/01ms316 KiB
2Accepted0/08ms316 KiB
3Accepted2/21ms316 KiB
4Accepted2/21ms316 KiB
5Accepted2/22ms316 KiB
6Accepted2/22ms316 KiB
7Accepted2/22ms500 KiB
8Accepted2/22ms316 KiB
9Accepted2/219ms1320 KiB
10Accepted2/243ms2128 KiB
11Accepted2/220ms400 KiB
12Accepted2/279ms400 KiB
13Accepted2/272ms316 KiB
14Accepted1/187ms316 KiB
15Accepted2/2104ms520 KiB
16Accepted2/2130ms1592 KiB
17Accepted2/2130ms1588 KiB
18Accepted2/2130ms1588 KiB
19Accepted2/2129ms1588 KiB
20Accepted2/275ms2100 KiB