189892025-11-13 20:20:28MagyarKendeSZLGIntervallumok (45 pont)cpp17Wrong answer 16/4543ms6028 KiB
#include <bits/stdc++.h>
using namespace std;
#define int int64_t

int32_t main() {
    cin.tie(0), ios::sync_with_stdio(0);
    int n;
    cin >> n;
    vector<int> a(n);
    for (int& x : a) cin >> x;

    vector<vector<int>> res;
    vector<int> res_w;
    for (int k = 1; k < n; k++) {
        if (n % k) continue;
        int nk = n / k;
        int w = 0;
        for (int i = nk - 1; i < n; i += nk) {
            int j = i - nk + 1;
            w = max(w, a[i] - a[j]);
        }
        bool ok = 1;
        for (int i = 2 * nk - 1; i < n; i += nk) {
            int j = i - nk;
            if (a[i] - a[j] <= w) {
                ok = 0;
                break;
            }
        }
        if (!ok) continue;
        res_w.push_back(w);
        res.push_back({});
        for (int i = nk - 1; i < n; i += nk) {
            res.back().push_back(a[i] - w);
        }
    }

    cout << res.size() << "\n";
    for (int i = 0; i < (int)res.size(); i++) {
        cout << res[i].size() << " " << res_w[i] << "\n";
        for (int x : res[i]) cout << x << "\n";
    }
}
SubtaskSumTestVerdictTimeMemory
base16/45
1Accepted0/01ms316 KiB
2Wrong answer0/01ms316 KiB
3Accepted1/11ms316 KiB
4Accepted1/11ms316 KiB
5Wrong answer0/11ms316 KiB
6Accepted1/13ms496 KiB
7Accepted1/116ms1076 KiB
8Wrong answer0/21ms316 KiB
9Wrong answer0/213ms1732 KiB
10Wrong answer0/217ms2200 KiB
11Wrong answer0/212ms1332 KiB
12Wrong answer0/217ms2140 KiB
13Wrong answer0/214ms1524 KiB
14Accepted2/23ms564 KiB
15Accepted2/24ms824 KiB
16Accepted2/24ms1076 KiB
17Accepted2/28ms1452 KiB
18Wrong answer0/28ms1332 KiB
19Accepted2/221ms2348 KiB
20Wrong answer0/239ms5844 KiB
21Accepted2/243ms6028 KiB
22Wrong answer0/232ms4524 KiB
23Wrong answer0/237ms5292 KiB
24Wrong answer0/29ms820 KiB
25Wrong answer0/214ms1848 KiB
26Wrong answer0/226ms3956 KiB
27Wrong answer0/214ms1076 KiB