193142025-12-04 15:33:05birozsIntervallumok (45 pont)python3Wrong answer 0/45601ms14488 KiB
N = int(input())
pont = list(map(int,input().split()))
Blokk = []
for K in range(1,N):
    if K == 1:
        Blokk.append([[K,pont[-1]-pont[0]],[pont[0]]])
        print(pont[0])
    if K > 1 and N % K == 0:
        if K == 2:
            koz = max([pont[N//2-1]-pont[0],pont[N-1]-pont[N//2]])
            Blokk.append([[2,koz],[pont[N//2-1]-koz,pont[N//2]]])
        else:
            Intervallumok = []
            hossz = N // K
            MaxHossz = 0
            for i in range(N):
                if i % hossz == hossz - 1:
                    Intervallumok.append([i-hossz+1,i])
                    if pont[i] - pont[i-hossz+1] > MaxHossz:
                        MaxHossz = pont[i] - pont[i-hossz+1]
            Szep = []
            Lehet = True
            AktPoz = - 3 * 10**8
            for bal,jobb in Intervallumok:
                if pont[jobb] - AktPoz >= MaxHossz:
                    Szep.append([pont[jobb]-MaxHossz,pont[jobb]])
                    AktPoz = pont[jobb] + 1
                elif pont[jobb+1] - 1 - AktPoz >= MaxHossz:
                    Szep.append([AktPoz,AktPoz + MaxHossz])
                    AktPoz = AktPoz + MaxHossz + 1
                else:
                    Lehet = False
                    break
            if Lehet:
                sor = []
                for bal,jobb in Szep:
                    sor.append(bal)
                Blokk.append([[K,MaxHossz],sor])
print(len(Blokk))
for k in Blokk:
    print(k[0][0],k[0][1])
    for x in k[1]:
        print(x)
            
SubtaskSumTestVerdictTimeMemory
base0/45
1Wrong answer0/016ms3124 KiB
2Wrong answer0/020ms3380 KiB
3Wrong answer0/117ms3124 KiB
4Wrong answer0/117ms3128 KiB
5Runtime error0/117ms3380 KiB
6Wrong answer0/164ms4252 KiB
7Time limit exceeded0/1601ms13984 KiB
8Runtime error0/217ms3316 KiB
9Time limit exceeded0/2601ms13272 KiB
10Time limit exceeded0/2601ms14488 KiB
11Time limit exceeded0/2583ms12212 KiB
12Time limit exceeded0/2587ms12636 KiB
13Time limit exceeded0/2592ms13528 KiB
14Wrong answer0/285ms4840 KiB
15Wrong answer0/2126ms5428 KiB
16Wrong answer0/2177ms6452 KiB
17Wrong answer0/2277ms7948 KiB
18Wrong answer0/2291ms7948 KiB
19Time limit exceeded0/2577ms12324 KiB
20Runtime error0/274ms12324 KiB
21Time limit exceeded0/2601ms12324 KiB
22Runtime error0/259ms12452 KiB
23Runtime error0/274ms12332 KiB
24Runtime error0/245ms9508 KiB
25Time limit exceeded0/2601ms9300 KiB
26Time limit exceeded0/2518ms9300 KiB
27Time limit exceeded0/2584ms12140 KiB