83872024-01-15 12:56:29anonIntervallumok (45 pont)cpp17Wrong answer 14/4546ms10776 KiB
#include <bits/stdc++.h>
#define FastIO ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
typedef long long ll;
const ll INF = (1LL << 62);
int main() {
    FastIO;
    ll i, j, ms, mindiff, N;
    cin >> N;
    vector<ll> A(N);
    for(i = 0; i < N; i++)
        cin >> A[i];
    vector<pair<ll, vector<ll>>> ans;
    for(i = N; i > 1; i--) {
        if(N % i)
            continue;
        ms = -INF;
        for(j = 0; j < N; j += i)
            ms = max(ms, A[j + i - 1] - A[j]);
        mindiff = INF;
        for(j = i; j < N - i; j += i)
            mindiff = min(mindiff, A[j + i] - A[j - 1]);
        if(mindiff <= ms)
            continue;
        ans.push_back({ ms, {} });
        for(j = i - 1; j < N; j += i)
            ans.back().second.push_back(A[j] - ms);
    }
    cout << ans.size() << '\n';
    for(const auto &x : ans) {
        cout << x.second.size() << ' ' << x.first << '\n';
        for(const auto &y : x.second)
            cout << y << '\n';
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base14/45
1Accepted0/03ms1864 KiB
2Wrong answer0/03ms2032 KiB
3Accepted1/13ms2132 KiB
4Accepted1/13ms2336 KiB
5Wrong answer0/13ms2552 KiB
6Accepted1/14ms2708 KiB
7Accepted1/117ms3964 KiB
8Wrong answer0/23ms2936 KiB
9Wrong answer0/218ms5644 KiB
10Wrong answer0/219ms6084 KiB
11Wrong answer0/218ms5940 KiB
12Wrong answer0/220ms6784 KiB
13Wrong answer0/218ms6332 KiB
14Accepted2/24ms4296 KiB
15Accepted2/26ms4628 KiB
16Accepted2/27ms4920 KiB
17Accepted2/29ms5448 KiB
18Wrong answer0/29ms5444 KiB
19Wrong answer0/237ms9148 KiB
20Wrong answer0/245ms10636 KiB
21Accepted2/246ms10776 KiB
22Wrong answer0/241ms9984 KiB
23Wrong answer0/243ms10500 KiB
24Wrong answer0/212ms5380 KiB
25Wrong answer0/224ms7600 KiB
26Wrong answer0/230ms8856 KiB
27Wrong answer0/217ms6028 KiB