Submission #10262741


Source Code Expand

N=int(input())
D=list(map(int, input().split()))

from collections import Counter
C = Counter(D)

ans = 0
import heapq
for pattern in range(1<<11):
    if C[0] >= 1: continue
    if C[12] >= 2: continue
    if C.most_common(1)[0][1] >= 3: continue
    q = [24]
    for d in range(1,12):
        if C[d] == 1:
            if pattern & 1: heapq.heappush(q, d)
            else: heapq.heappush(q, 24-d)
        elif C[d] == 2:
            heapq.heappush(q, d)
            heapq.heappush(q, 24-d)
        pattern>>=1
    if C[12] == 1: heapq.heappush(q, 12)
    pre = 0
    tmp = 24
    for _ in range(N+1):
        d = heapq.heappop(q)
        tmp = min(tmp, d-pre)
        pre = d
    ans = max(ans, tmp)

print(ans)

Submission Info

Submission Time
Task C - Time Gap
User w0mbat
Language PyPy3 (2.4.0)
Score 500
Code Size 746 Byte
Status AC
Exec Time 400 ms
Memory 58328 KB

Judge Result

Set Name sample All
Score / Max Score 0 / 0 500 / 500
Status
AC × 3
AC × 49
Set Name Test Cases
sample sample-01.txt, sample-02.txt, sample-03.txt
All sample-01.txt, sample-02.txt, sample-03.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt, 01-15.txt, 01-16.txt, 01-17.txt, 01-18.txt, 01-19.txt, 01-20.txt, 01-21.txt, 01-22.txt, 01-23.txt, 01-24.txt, 01-25.txt, 01-26.txt, 01-27.txt, 01-28.txt, 01-29.txt, 01-30.txt, 01-31.txt, 01-32.txt, 01-33.txt, 01-34.txt, 01-35.txt, 01-36.txt, 01-37.txt, 01-38.txt, 01-39.txt, 01-40.txt, 01-41.txt, 01-42.txt, 01-43.txt, sample-01.txt, sample-02.txt, sample-03.txt
Case Name Status Exec Time Memory
01-01.txt AC 264 ms 46828 KB
01-02.txt AC 286 ms 48220 KB
01-03.txt AC 318 ms 51548 KB
01-04.txt AC 164 ms 38512 KB
01-05.txt AC 163 ms 38512 KB
01-06.txt AC 166 ms 38512 KB
01-07.txt AC 209 ms 41944 KB
01-08.txt AC 361 ms 54620 KB
01-09.txt AC 212 ms 42072 KB
01-10.txt AC 386 ms 57308 KB
01-11.txt AC 168 ms 38512 KB
01-12.txt AC 210 ms 42072 KB
01-13.txt AC 211 ms 41944 KB
01-14.txt AC 166 ms 38512 KB
01-15.txt AC 216 ms 42200 KB
01-16.txt AC 167 ms 38512 KB
01-17.txt AC 249 ms 45292 KB
01-18.txt AC 250 ms 45404 KB
01-19.txt AC 273 ms 47324 KB
01-20.txt AC 310 ms 50908 KB
01-21.txt AC 257 ms 46428 KB
01-22.txt AC 321 ms 51548 KB
01-23.txt AC 320 ms 51676 KB
01-24.txt AC 322 ms 51932 KB
01-25.txt AC 321 ms 51388 KB
01-26.txt AC 346 ms 54108 KB
01-27.txt AC 278 ms 48220 KB
01-28.txt AC 278 ms 48220 KB
01-29.txt AC 313 ms 50780 KB
01-30.txt AC 345 ms 53724 KB
01-31.txt AC 338 ms 53340 KB
01-32.txt AC 341 ms 53084 KB
01-33.txt AC 363 ms 56028 KB
01-34.txt AC 333 ms 52828 KB
01-35.txt AC 382 ms 56668 KB
01-36.txt AC 323 ms 51932 KB
01-37.txt AC 384 ms 56412 KB
01-38.txt AC 400 ms 58328 KB
01-39.txt AC 320 ms 51036 KB
01-40.txt AC 167 ms 38512 KB
01-41.txt AC 196 ms 41064 KB
01-42.txt AC 195 ms 41064 KB
01-43.txt AC 317 ms 51420 KB
sample-01.txt AC 304 ms 50396 KB
sample-02.txt AC 251 ms 46044 KB
sample-03.txt AC 164 ms 38512 KB