193152025-12-04 15:37:17birozsIntervallumok (45 pont)python3Runtime error 13/45601ms14428 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]]])
    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
base13/45
1Accepted0/016ms3144 KiB
2Accepted0/020ms3392 KiB
3Accepted1/116ms3124 KiB
4Accepted1/117ms3244 KiB
5Runtime error0/117ms3372 KiB
6Accepted1/163ms4376 KiB
7Time limit exceeded0/1582ms14052 KiB
8Runtime error0/217ms3316 KiB
9Time limit exceeded0/2577ms13080 KiB
10Time limit exceeded0/2601ms14428 KiB
11Time limit exceeded0/2583ms10428 KiB
12Time limit exceeded0/2578ms11612 KiB
13Time limit exceeded0/2583ms13684 KiB
14Accepted2/290ms4660 KiB
15Accepted2/2130ms5424 KiB
16Accepted2/2178ms6452 KiB
17Accepted2/2284ms7960 KiB
18Accepted2/2279ms7948 KiB
19Time limit exceeded0/2584ms12320 KiB
20Runtime error0/271ms12376 KiB
21Time limit exceeded0/2580ms12324 KiB
22Runtime error0/256ms12324 KiB
23Runtime error0/275ms12376 KiB
24Runtime error0/243ms9312 KiB
25Time limit exceeded0/2587ms9312 KiB
26Time limit exceeded0/2519ms9296 KiB
27Time limit exceeded0/2574ms12140 KiB