結果
問題 | No.1990 Candy Boxes |
ユーザー | mkawa2 |
提出日時 | 2022-06-25 08:58:36 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,503 bytes |
コンパイル時間 | 463 ms |
コンパイル使用メモリ | 81,836 KB |
実行使用メモリ | 126,464 KB |
最終ジャッジ日時 | 2024-11-20 15:34:33 |
合計ジャッジ時間 | 12,114 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 40 ms
52,876 KB |
testcase_01 | AC | 42 ms
52,812 KB |
testcase_02 | AC | 40 ms
52,528 KB |
testcase_03 | WA | - |
testcase_04 | AC | 40 ms
52,452 KB |
testcase_05 | WA | - |
testcase_06 | AC | 40 ms
52,656 KB |
testcase_07 | WA | - |
testcase_08 | AC | 41 ms
52,900 KB |
testcase_09 | AC | 41 ms
52,276 KB |
testcase_10 | AC | 40 ms
52,220 KB |
testcase_11 | WA | - |
testcase_12 | AC | 86 ms
104,496 KB |
testcase_13 | AC | 86 ms
105,280 KB |
testcase_14 | AC | 160 ms
101,888 KB |
testcase_15 | AC | 168 ms
109,312 KB |
testcase_16 | AC | 171 ms
110,060 KB |
testcase_17 | AC | 188 ms
113,480 KB |
testcase_18 | AC | 188 ms
113,152 KB |
testcase_19 | AC | 175 ms
110,976 KB |
testcase_20 | AC | 190 ms
115,840 KB |
testcase_21 | AC | 186 ms
114,816 KB |
testcase_22 | AC | 186 ms
103,424 KB |
testcase_23 | AC | 174 ms
97,504 KB |
testcase_24 | AC | 207 ms
97,756 KB |
testcase_25 | AC | 231 ms
121,440 KB |
testcase_26 | AC | 197 ms
120,388 KB |
testcase_27 | AC | 195 ms
120,340 KB |
testcase_28 | AC | 246 ms
126,336 KB |
testcase_29 | AC | 200 ms
125,696 KB |
testcase_30 | AC | 217 ms
115,028 KB |
testcase_31 | AC | 209 ms
126,464 KB |
testcase_32 | AC | 152 ms
99,200 KB |
testcase_33 | AC | 180 ms
114,048 KB |
testcase_34 | AC | 110 ms
102,144 KB |
testcase_35 | AC | 138 ms
114,304 KB |
testcase_36 | AC | 131 ms
114,944 KB |
testcase_37 | AC | 200 ms
118,984 KB |
testcase_38 | AC | 177 ms
109,312 KB |
testcase_39 | AC | 178 ms
113,536 KB |
testcase_40 | AC | 200 ms
123,392 KB |
testcase_41 | AC | 195 ms
122,368 KB |
testcase_42 | AC | 153 ms
100,864 KB |
testcase_43 | AC | 168 ms
112,512 KB |
testcase_44 | AC | 167 ms
107,520 KB |
testcase_45 | WA | - |
testcase_46 | WA | - |
testcase_47 | WA | - |
testcase_48 | WA | - |
testcase_49 | AC | 40 ms
52,480 KB |
testcase_50 | AC | 41 ms
52,736 KB |
testcase_51 | AC | 42 ms
52,864 KB |
testcase_52 | WA | - |
testcase_53 | AC | 42 ms
52,736 KB |
testcase_54 | WA | - |
testcase_55 | AC | 40 ms
53,120 KB |
testcase_56 | AC | 39 ms
52,864 KB |
testcase_57 | WA | - |
testcase_58 | WA | - |
testcase_59 | WA | - |
testcase_60 | AC | 39 ms
52,736 KB |
testcase_61 | AC | 40 ms
52,480 KB |
testcase_62 | AC | 38 ms
52,736 KB |
testcase_63 | AC | 38 ms
52,224 KB |
testcase_64 | AC | 40 ms
52,608 KB |
testcase_65 | AC | 143 ms
119,424 KB |
testcase_66 | WA | - |
testcase_67 | AC | 138 ms
114,560 KB |
testcase_68 | AC | 154 ms
102,144 KB |
testcase_69 | AC | 104 ms
114,776 KB |
testcase_70 | AC | 122 ms
114,432 KB |
testcase_71 | WA | - |
testcase_72 | WA | - |
testcase_73 | AC | 195 ms
105,984 KB |
testcase_74 | WA | - |
testcase_75 | AC | 185 ms
110,464 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() 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) # print(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 # print(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")