結果
問題 | No.1990 Candy Boxes |
ユーザー | mkawa2 |
提出日時 | 2022-06-25 09:04:19 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,625 bytes |
コンパイル時間 | 219 ms |
コンパイル使用メモリ | 82,468 KB |
実行使用メモリ | 281,560 KB |
最終ジャッジ日時 | 2024-11-20 15:36:14 |
合計ジャッジ時間 | 100,512 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 42 ms
60,852 KB |
testcase_01 | AC | 41 ms
243,140 KB |
testcase_02 | AC | 42 ms
60,028 KB |
testcase_03 | WA | - |
testcase_04 | AC | 40 ms
60,016 KB |
testcase_05 | AC | 40 ms
60,392 KB |
testcase_06 | AC | 39 ms
59,708 KB |
testcase_07 | AC | 40 ms
60,628 KB |
testcase_08 | AC | 41 ms
60,116 KB |
testcase_09 | AC | 39 ms
60,976 KB |
testcase_10 | AC | 40 ms
58,468 KB |
testcase_11 | WA | - |
testcase_12 | AC | 99 ms
111,836 KB |
testcase_13 | AC | 100 ms
113,756 KB |
testcase_14 | AC | 62 ms
87,296 KB |
testcase_15 | AC | 66 ms
95,268 KB |
testcase_16 | AC | 67 ms
93,160 KB |
testcase_17 | AC | 71 ms
98,288 KB |
testcase_18 | AC | 72 ms
99,360 KB |
testcase_19 | AC | 72 ms
97,648 KB |
testcase_20 | AC | 75 ms
101,764 KB |
testcase_21 | AC | 74 ms
281,560 KB |
testcase_22 | AC | 68 ms
92,864 KB |
testcase_23 | AC | 73 ms
250,036 KB |
testcase_24 | AC | 73 ms
98,240 KB |
testcase_25 | AC | 91 ms
259,080 KB |
testcase_26 | TLE | - |
testcase_27 | TLE | - |
testcase_28 | TLE | - |
testcase_29 | TLE | - |
testcase_30 | TLE | - |
testcase_31 | TLE | - |
testcase_32 | TLE | - |
testcase_33 | TLE | - |
testcase_34 | TLE | - |
testcase_35 | TLE | - |
testcase_36 | TLE | - |
testcase_37 | TLE | - |
testcase_38 | TLE | - |
testcase_39 | TLE | - |
testcase_40 | TLE | - |
testcase_41 | TLE | - |
testcase_42 | TLE | - |
testcase_43 | TLE | - |
testcase_44 | TLE | - |
testcase_45 | AC | 79 ms
93,860 KB |
testcase_46 | TLE | - |
testcase_47 | TLE | - |
testcase_48 | TLE | - |
testcase_49 | AC | 48 ms
57,984 KB |
testcase_50 | AC | 47 ms
60,704 KB |
testcase_51 | AC | 49 ms
58,368 KB |
testcase_52 | WA | - |
testcase_53 | AC | 50 ms
58,112 KB |
testcase_54 | WA | - |
testcase_55 | AC | 62 ms
58,240 KB |
testcase_56 | AC | 43 ms
59,760 KB |
testcase_57 | WA | - |
testcase_58 | WA | - |
testcase_59 | WA | - |
testcase_60 | AC | 43 ms
52,864 KB |
testcase_61 | AC | 44 ms
52,608 KB |
testcase_62 | AC | 43 ms
52,608 KB |
testcase_63 | AC | 44 ms
52,736 KB |
testcase_64 | AC | 44 ms
52,736 KB |
testcase_65 | TLE | - |
testcase_66 | TLE | - |
testcase_67 | TLE | - |
testcase_68 | TLE | - |
testcase_69 | TLE | - |
testcase_70 | TLE | - |
testcase_71 | TLE | - |
testcase_72 | TLE | - |
testcase_73 | AC | 100 ms
102,400 KB |
testcase_74 | TLE | - |
testcase_75 | AC | 82 ms
255,768 KB |
ソースコード
import sys sys.setrecursionlimit(200005) int1 = lambda x: int(x)-1 pDB = lambda *x: print(*x, end="\n", file=sys.stderr) p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr) def II(): return int(sys.stdin.readline()) def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] def LI1(): return list(map(int1, sys.stdin.readline().split())) def LLI1(rows_number): return [LI1() for _ in range(rows_number)] def SI(): return sys.stdin.readline().rstrip() dij = [(0, 1), (-1, 0), (0, -1), (1, 0)] # dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)] inf = (1 << 63)-1 # inf = (1 << 31)-1 # md = 10**9+7 md = 998244353 from heapq import * n = II() aa = [0]+LI() now=0 for i in range(n): now=aa[i+1]-now if now<0: print("No") exit() if now: print("No") exit() q = [] dd = [] for i in range(n): dd.append(aa[i+1]-aa[i]) if dd[-1] & 1 == 0: heappush(q, i) dd.append(0) pDB(q, dd) for i in range(n-1): if dd[i] & 1 == 0: continue if dd[i+1] & 1 == 0: d = dd[i] dd[i] -= d dd[i+2] += d else: while q and (q[0] <= i or dd[q[0]] & 1): heappop(q) if not q: print("No") exit() j = q[0] if dd[i+1] & 1 and dd[j+1] & 1: heappush(q, j+1) dd[j] += dd[i] dd[j+1] += dd[i+1] dd[i] = dd[i+1] = 0 pDB(q, dd) def ng(si): now = 0 for i in range(si, n, 2): now += dd[i] if now < 0: return True return False print("No" if ng(0) or ng(1) else "Yes")