Submission #10262333
Source Code Expand
N=int(input()) D=list(map(int, input().split())) #同じ数が3個以上あるとsは0になる #0か12が2個以上ある場合も0になる from collections import Counter C = Counter(D) if C.most_common(1)[0][1] >= 3 or\ C[0] > 1 or C[12] > 1: print(0) exit() #同じ数が2個以下、0と12は1個以下なので、Nは24以下 #2**24パターンを全調査する def diff(a, b): d = abs(a-b) return min(d, 24-d) ans = 0 import heapq for pattern in range(1<<N): q = [] for d in D: if pattern & 1: if d == 0 or d == 12: break d = 24 - d heapq.heappush(q, d) pattern>>=1 if len(q) != N: continue pre = 0 tmp = 24 for _ in range(N): d = heapq.heappop(q) tmp = min(tmp, diff(pre, d)) pre = d ans = max(ans, tmp) print(ans)
Submission Info
Submission Time | |
---|---|
Task | C - Time Gap |
User | w0mbat |
Language | PyPy3 (2.4.0) |
Score | 0 |
Code Size | 887 Byte |
Status | WA |
Exec Time | 2107 ms |
Memory | 69596 KB |
Judge Result
Set Name | sample | All | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 500 | ||||||||
Status |
|
|
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 | 184 ms | 38384 KB |
01-02.txt | WA | 180 ms | 38256 KB |
01-03.txt | WA | 179 ms | 38256 KB |
01-04.txt | AC | 180 ms | 38256 KB |
01-05.txt | AC | 179 ms | 38256 KB |
01-06.txt | AC | 180 ms | 38256 KB |
01-07.txt | AC | 178 ms | 38256 KB |
01-08.txt | AC | 228 ms | 42480 KB |
01-09.txt | AC | 177 ms | 38256 KB |
01-10.txt | AC | 298 ms | 49496 KB |
01-11.txt | AC | 181 ms | 38256 KB |
01-12.txt | AC | 177 ms | 38256 KB |
01-13.txt | AC | 172 ms | 38256 KB |
01-14.txt | AC | 174 ms | 38256 KB |
01-15.txt | AC | 185 ms | 38256 KB |
01-16.txt | AC | 174 ms | 38256 KB |
01-17.txt | AC | 173 ms | 38256 KB |
01-18.txt | AC | 174 ms | 38256 KB |
01-19.txt | AC | 175 ms | 38256 KB |
01-20.txt | AC | 180 ms | 38256 KB |
01-21.txt | AC | 171 ms | 38256 KB |
01-22.txt | WA | 183 ms | 38256 KB |
01-23.txt | WA | 177 ms | 38256 KB |
01-24.txt | AC | 178 ms | 38384 KB |
01-25.txt | WA | 177 ms | 38256 KB |
01-26.txt | WA | 173 ms | 38256 KB |
01-27.txt | AC | 173 ms | 38256 KB |
01-28.txt | AC | 176 ms | 38256 KB |
01-29.txt | AC | 173 ms | 38256 KB |
01-30.txt | AC | 175 ms | 38256 KB |
01-31.txt | AC | 178 ms | 38256 KB |
01-32.txt | AC | 180 ms | 38512 KB |
01-33.txt | AC | 207 ms | 41304 KB |
01-34.txt | AC | 285 ms | 47708 KB |
01-35.txt | AC | 322 ms | 51804 KB |
01-36.txt | AC | 336 ms | 54108 KB |
01-37.txt | AC | 359 ms | 55388 KB |
01-38.txt | AC | 405 ms | 56284 KB |
01-39.txt | TLE | 2107 ms | 69596 KB |
01-40.txt | TLE | 2107 ms | 57820 KB |
01-41.txt | AC | 176 ms | 38256 KB |
01-42.txt | AC | 179 ms | 38256 KB |
01-43.txt | AC | 182 ms | 38256 KB |
sample-01.txt | AC | 176 ms | 38256 KB |
sample-02.txt | AC | 177 ms | 38256 KB |
sample-03.txt | AC | 170 ms | 38256 KB |