結果
問題 | No.1990 Candy Boxes |
ユーザー | mkawa2 |
提出日時 | 2022-06-25 10:46:21 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,637 bytes |
コンパイル時間 | 252 ms |
コンパイル使用メモリ | 82,416 KB |
実行使用メモリ | 126,688 KB |
最終ジャッジ日時 | 2024-11-20 15:36:49 |
合計ジャッジ時間 | 10,330 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 45 ms
52,736 KB |
testcase_01 | AC | 39 ms
52,224 KB |
testcase_02 | AC | 41 ms
52,736 KB |
testcase_03 | AC | 40 ms
52,608 KB |
testcase_04 | AC | 41 ms
52,608 KB |
testcase_05 | AC | 40 ms
52,224 KB |
testcase_06 | AC | 41 ms
52,608 KB |
testcase_07 | AC | 40 ms
52,608 KB |
testcase_08 | AC | 40 ms
52,224 KB |
testcase_09 | AC | 40 ms
52,864 KB |
testcase_10 | AC | 42 ms
52,352 KB |
testcase_11 | AC | 39 ms
52,480 KB |
testcase_12 | AC | 87 ms
105,600 KB |
testcase_13 | AC | 92 ms
107,124 KB |
testcase_14 | AC | 63 ms
81,664 KB |
testcase_15 | AC | 68 ms
87,296 KB |
testcase_16 | AC | 69 ms
87,552 KB |
testcase_17 | AC | 71 ms
90,368 KB |
testcase_18 | AC | 69 ms
91,264 KB |
testcase_19 | AC | 73 ms
90,240 KB |
testcase_20 | AC | 76 ms
94,720 KB |
testcase_21 | AC | 76 ms
94,464 KB |
testcase_22 | AC | 67 ms
85,376 KB |
testcase_23 | AC | 74 ms
92,800 KB |
testcase_24 | AC | 74 ms
92,800 KB |
testcase_25 | AC | 94 ms
100,424 KB |
testcase_26 | AC | 192 ms
120,468 KB |
testcase_27 | AC | 191 ms
120,576 KB |
testcase_28 | AC | 258 ms
126,688 KB |
testcase_29 | AC | 197 ms
126,208 KB |
testcase_30 | AC | 177 ms
114,768 KB |
testcase_31 | AC | 205 ms
125,952 KB |
testcase_32 | AC | 152 ms
99,200 KB |
testcase_33 | AC | 178 ms
113,792 KB |
testcase_34 | AC | 109 ms
102,016 KB |
testcase_35 | AC | 130 ms
114,560 KB |
testcase_36 | AC | 128 ms
114,688 KB |
testcase_37 | AC | 196 ms
118,904 KB |
testcase_38 | AC | 178 ms
109,568 KB |
testcase_39 | AC | 175 ms
113,664 KB |
testcase_40 | AC | 192 ms
123,596 KB |
testcase_41 | AC | 189 ms
121,984 KB |
testcase_42 | AC | 147 ms
100,992 KB |
testcase_43 | AC | 162 ms
112,000 KB |
testcase_44 | AC | 161 ms
108,288 KB |
testcase_45 | AC | 67 ms
86,912 KB |
testcase_46 | WA | - |
testcase_47 | WA | - |
testcase_48 | WA | - |
testcase_49 | AC | 42 ms
52,224 KB |
testcase_50 | AC | 40 ms
52,736 KB |
testcase_51 | AC | 40 ms
52,224 KB |
testcase_52 | AC | 40 ms
52,608 KB |
testcase_53 | AC | 40 ms
53,248 KB |
testcase_54 | AC | 41 ms
52,992 KB |
testcase_55 | AC | 40 ms
52,992 KB |
testcase_56 | AC | 40 ms
52,608 KB |
testcase_57 | AC | 40 ms
52,864 KB |
testcase_58 | AC | 42 ms
52,992 KB |
testcase_59 | AC | 40 ms
52,736 KB |
testcase_60 | AC | 40 ms
52,480 KB |
testcase_61 | AC | 39 ms
52,608 KB |
testcase_62 | AC | 40 ms
53,080 KB |
testcase_63 | AC | 40 ms
52,992 KB |
testcase_64 | AC | 40 ms
52,608 KB |
testcase_65 | AC | 151 ms
119,424 KB |
testcase_66 | AC | 145 ms
109,696 KB |
testcase_67 | AC | 142 ms
113,920 KB |
testcase_68 | AC | 160 ms
101,888 KB |
testcase_69 | AC | 107 ms
114,560 KB |
testcase_70 | AC | 125 ms
115,072 KB |
testcase_71 | WA | - |
testcase_72 | WA | - |
testcase_73 | AC | 85 ms
101,760 KB |
testcase_74 | WA | - |
testcase_75 | AC | 69 ms
88,320 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) def move(i,j): dd[j] += 1 dd[i] -= 1 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[j+1] & 1: heappush(q, j+1) move(i,j) move(i+1,j+1) # 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) or dd[-2] else "Yes")