194012025-12-08 11:54:32vargaviviIntervallumok (45 pont)cpp17Wrong answer 11/45600ms7244 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() {
    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/04ms3816 KiB
3Accepted1/14ms3380 KiB
4Accepted1/14ms3380 KiB
5Wrong answer0/14ms3380 KiB
6Accepted1/139ms3636 KiB
7Time limit exceeded0/1600ms4916 KiB
8Wrong answer0/24ms3380 KiB
9Time limit exceeded0/2600ms4912 KiB
10Time limit exceeded0/2600ms5340 KiB
11Time limit exceeded0/2600ms4824 KiB
12Time limit exceeded0/2578ms5424 KiB
13Time limit exceeded0/2600ms5424 KiB
14Accepted2/217ms3748 KiB
15Accepted2/228ms3880 KiB
16Accepted2/245ms4240 KiB
17Accepted2/290ms4748 KiB
18Wrong answer0/290ms4468 KiB
19Time limit exceeded0/2584ms4844 KiB
20Time limit exceeded0/2600ms7244 KiB
21Time limit exceeded0/2582ms6568 KiB
22Time limit exceeded0/2600ms5592 KiB
23Time limit exceeded0/2589ms6104 KiB
24Time limit exceeded0/2578ms4404 KiB
25Time limit exceeded0/2580ms4828 KiB
26Time limit exceeded0/2600ms6020 KiB
27Time limit exceeded0/2582ms4772 KiB