217532026-01-13 19:08:18TaxiradioIntervallumok (45 pont)cpp17Accepted 45/4579ms6860 KiB
// Source: https://usaco.guide/general/io

#include <algorithm>
#include <bits/stdc++.h>
using namespace std;

#define int int64_t
vector<int> a;
int n; 

vector<int> tr(int k){
    vector<int> ans;
    ans.push_back(k);
    int e = n/k;
    int l = 0 , j = 0;
    for(int i = 0; i < n; i+=e){
        l = max(l , a[i+e-1]-a[i]+1);
    }
    ans.push_back(l-1);
    int r = -1e9;
    for(int i = 0; i < n; i+=e){
        if(r >= a[i])return{};
        r = max(r+l , a[i+e-1]);
        ans.push_back(r-l+1);
    }
    return ans;
}


int32_t main() {
    cin >> n;

    for(int i = 0; i < n; i++){
        int x; cin >> x;
        a.push_back(x);
    }
    vector<vector<int>> an;
    for(int i = 1; i < n; i++){
        if(n%i!=0)continue;
        vector<int> ans = tr(i);
        if(!ans.empty()){
            an.push_back(ans);
        }
    }
    cout << an.size() << endl;
    for(auto ans : an){
        cout << ans[0] << " " << ans[1] << "\n";
        for(int j = 2; j < ans.size();j++)cout << ans[j] << "\n";
    }
}
SubtaskSumTestVerdictTimeMemory
base45/45
1Accepted0/01ms500 KiB
2Accepted0/02ms316 KiB
3Accepted1/11ms500 KiB
4Accepted1/11ms316 KiB
5Accepted1/12ms316 KiB
6Accepted1/16ms564 KiB
7Accepted1/146ms1452 KiB
8Accepted2/21ms316 KiB
9Accepted2/235ms1988 KiB
10Accepted2/239ms2276 KiB
11Accepted2/235ms1916 KiB
12Accepted2/241ms2472 KiB
13Accepted2/237ms2416 KiB
14Accepted2/24ms564 KiB
15Accepted2/27ms820 KiB
16Accepted2/28ms912 KiB
17Accepted2/214ms1332 KiB
18Accepted2/214ms1332 KiB
19Accepted2/250ms3612 KiB
20Accepted2/279ms6860 KiB
21Accepted2/279ms6568 KiB
22Accepted2/271ms5288 KiB
23Accepted2/275ms5796 KiB
24Accepted2/228ms944 KiB
25Accepted2/241ms2988 KiB
26Accepted2/252ms4328 KiB
27Accepted2/239ms1452 KiB