結果
問題 | No.1290 Addition and Subtraction Operation |
ユーザー | chineristAC |
提出日時 | 2020-11-13 22:44:55 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 418 ms / 2,000 ms |
コード長 | 858 bytes |
コンパイル時間 | 166 ms |
コンパイル使用メモリ | 82,152 KB |
実行使用メモリ | 128,768 KB |
最終ジャッジ日時 | 2024-07-22 21:45:14 |
合計ジャッジ時間 | 10,847 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 39 ms
52,352 KB |
testcase_01 | AC | 41 ms
52,480 KB |
testcase_02 | AC | 42 ms
51,968 KB |
testcase_03 | AC | 38 ms
52,352 KB |
testcase_04 | AC | 38 ms
52,096 KB |
testcase_05 | AC | 37 ms
51,968 KB |
testcase_06 | AC | 37 ms
51,840 KB |
testcase_07 | AC | 39 ms
51,840 KB |
testcase_08 | AC | 37 ms
52,224 KB |
testcase_09 | AC | 38 ms
52,608 KB |
testcase_10 | AC | 40 ms
51,840 KB |
testcase_11 | AC | 38 ms
52,224 KB |
testcase_12 | AC | 37 ms
52,224 KB |
testcase_13 | AC | 38 ms
51,968 KB |
testcase_14 | AC | 39 ms
52,224 KB |
testcase_15 | AC | 38 ms
52,352 KB |
testcase_16 | AC | 36 ms
52,352 KB |
testcase_17 | AC | 39 ms
52,224 KB |
testcase_18 | AC | 38 ms
52,096 KB |
testcase_19 | AC | 39 ms
51,840 KB |
testcase_20 | AC | 38 ms
51,840 KB |
testcase_21 | AC | 39 ms
52,224 KB |
testcase_22 | AC | 38 ms
51,968 KB |
testcase_23 | AC | 38 ms
51,968 KB |
testcase_24 | AC | 39 ms
51,968 KB |
testcase_25 | AC | 42 ms
51,968 KB |
testcase_26 | AC | 37 ms
51,968 KB |
testcase_27 | AC | 38 ms
51,840 KB |
testcase_28 | AC | 37 ms
52,224 KB |
testcase_29 | AC | 38 ms
51,968 KB |
testcase_30 | AC | 37 ms
51,968 KB |
testcase_31 | AC | 37 ms
51,968 KB |
testcase_32 | AC | 38 ms
52,480 KB |
testcase_33 | AC | 38 ms
52,352 KB |
testcase_34 | AC | 38 ms
51,968 KB |
testcase_35 | AC | 40 ms
52,324 KB |
testcase_36 | AC | 38 ms
52,480 KB |
testcase_37 | AC | 40 ms
52,352 KB |
testcase_38 | AC | 39 ms
51,968 KB |
testcase_39 | AC | 37 ms
51,840 KB |
testcase_40 | AC | 38 ms
52,096 KB |
testcase_41 | AC | 37 ms
51,968 KB |
testcase_42 | AC | 81 ms
77,312 KB |
testcase_43 | AC | 77 ms
77,560 KB |
testcase_44 | AC | 78 ms
77,952 KB |
testcase_45 | AC | 77 ms
77,552 KB |
testcase_46 | AC | 79 ms
77,184 KB |
testcase_47 | AC | 80 ms
77,552 KB |
testcase_48 | AC | 76 ms
77,440 KB |
testcase_49 | AC | 77 ms
77,440 KB |
testcase_50 | AC | 77 ms
77,560 KB |
testcase_51 | AC | 78 ms
77,312 KB |
testcase_52 | AC | 77 ms
77,312 KB |
testcase_53 | AC | 78 ms
77,824 KB |
testcase_54 | AC | 76 ms
77,572 KB |
testcase_55 | AC | 85 ms
77,952 KB |
testcase_56 | AC | 78 ms
77,440 KB |
testcase_57 | AC | 98 ms
92,952 KB |
testcase_58 | AC | 105 ms
92,928 KB |
testcase_59 | AC | 94 ms
93,184 KB |
testcase_60 | AC | 388 ms
113,280 KB |
testcase_61 | AC | 250 ms
100,916 KB |
testcase_62 | AC | 306 ms
102,536 KB |
testcase_63 | AC | 105 ms
93,440 KB |
testcase_64 | AC | 71 ms
86,016 KB |
testcase_65 | AC | 90 ms
92,928 KB |
testcase_66 | AC | 123 ms
93,312 KB |
testcase_67 | AC | 418 ms
120,192 KB |
testcase_68 | AC | 140 ms
93,488 KB |
testcase_69 | AC | 103 ms
93,548 KB |
testcase_70 | AC | 105 ms
93,056 KB |
testcase_71 | AC | 120 ms
93,952 KB |
testcase_72 | AC | 91 ms
93,216 KB |
testcase_73 | AC | 126 ms
93,312 KB |
testcase_74 | AC | 66 ms
83,328 KB |
testcase_75 | AC | 90 ms
93,056 KB |
testcase_76 | AC | 101 ms
93,440 KB |
testcase_77 | AC | 327 ms
101,504 KB |
testcase_78 | AC | 265 ms
96,032 KB |
testcase_79 | AC | 192 ms
94,080 KB |
testcase_80 | AC | 407 ms
122,624 KB |
testcase_81 | AC | 417 ms
128,768 KB |
testcase_82 | AC | 129 ms
93,824 KB |
testcase_83 | AC | 338 ms
109,440 KB |
testcase_84 | AC | 142 ms
93,900 KB |
testcase_85 | AC | 100 ms
94,464 KB |
testcase_86 | AC | 83 ms
94,208 KB |
ソースコード
import sys input = sys.stdin.readline sys.setrecursionlimit(2*10**5) N,M = map(int,input().split()) B = list(map(int,input().split())) for i in range(1,N,2): B[i] = -B[i] for i in range(N-1,0,-1): B[i] -= B[i-1] edge = [[] for i in range(N+1)] for _ in range(M): l,r = map(int,input().split()) edge[r].append(l-1) edge[l-1].append(r) used = [False]*(N+1) tmp = 0 def dfs(v): global tmp for nv in edge[v]: if not used[nv]: used[nv] = True if nv!=N: tmp += B[nv] dfs(nv) for i in range(N): tmp = 0 check = used[-1] if not used[i]: used[i] = True tmp += B[i] dfs(i) check2 = used[-1] if not check and check2: continue else: if tmp!=0: exit(print("NO")) print("YES")