194022025-12-08 12:02:02vargaviviIntervallumok (45 pont)cpp17Wrong answer 11/45600ms6568 KiB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

const int MAXN = 1e5 + 2;
vector<ll> lens(MAXN, -1);
vector<vector<ll>> ans(MAXN);
int db = 0;

void solve(int n, vector<ll> v, int intdb) {
    if (n % intdb != 0) return;
    int pont = n / intdb;
    ll minhossz = 0;
    for (int i = 0; i < intdb; i ++) {
        minhossz = max(minhossz, v[(i + 1) * pont - 1] - v[i * pont]);
    }
 //   cout << intdb << " " << pont << " " << minhossz << "\n";
    lens[intdb] = minhossz;
    ans[intdb].push_back(v[pont - 1] - minhossz);
    for (int i = 1; i < intdb; i ++) {
        ll elozo = v[i * pont - 1], bal = v[(i + 1) * pont - 1] - minhossz;
        if (elozo >= bal) {
            lens[intdb] = -1;
            return;
        }
        ans[intdb].push_back(bal);
    }
    db ++;
    return;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    vector<ll> v(n);
    for (int i = 0; i < n; i ++) cin >> v[i];
    for (int i = 1; i < n; i ++) solve(n, v, i);
    cout << db << "\n";
    for (int i = 1; i < n; i ++) {
        if (lens[i] != -1) {
            cout << i << " " << lens[i] << "\n";
            for (ll c : ans[i]) cout << c << "\n";
        }
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base11/45
1Accepted0/04ms3380 KiB
2Wrong answer0/03ms3380 KiB
3Accepted1/14ms3380 KiB
4Accepted1/14ms3380 KiB
5Wrong answer0/14ms3380 KiB
6Accepted1/137ms3636 KiB
7Time limit exceeded0/1600ms5124 KiB
8Wrong answer0/24ms3380 KiB
9Time limit exceeded0/2600ms5120 KiB
10Time limit exceeded0/2600ms5364 KiB
11Time limit exceeded0/2591ms4856 KiB
12Time limit exceeded0/2580ms5356 KiB
13Time limit exceeded0/2600ms5116 KiB
14Accepted2/214ms3892 KiB
15Accepted2/226ms3884 KiB
16Accepted2/241ms4188 KiB
17Accepted2/282ms4588 KiB
18Wrong answer0/282ms4660 KiB
19Time limit exceeded0/2587ms4776 KiB
20Time limit exceeded0/2592ms6308 KiB
21Time limit exceeded0/2584ms6568 KiB
22Time limit exceeded0/2600ms5640 KiB
23Time limit exceeded0/2584ms6052 KiB
24Time limit exceeded0/2574ms4404 KiB
25Time limit exceeded0/2587ms4988 KiB
26Time limit exceeded0/2600ms5980 KiB
27Time limit exceeded0/2583ms4784 KiB