結果
問題 | No.1290 Addition and Subtraction Operation |
ユーザー | chineristAC |
提出日時 | 2020-11-13 22:46:57 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 415 ms / 2,000 ms |
コード長 | 858 bytes |
コンパイル時間 | 484 ms |
コンパイル使用メモリ | 82,500 KB |
実行使用メモリ | 128,384 KB |
最終ジャッジ日時 | 2024-07-22 21:46:57 |
合計ジャッジ時間 | 11,413 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 37 ms
51,840 KB |
testcase_01 | AC | 38 ms
51,968 KB |
testcase_02 | AC | 38 ms
52,224 KB |
testcase_03 | AC | 37 ms
52,352 KB |
testcase_04 | AC | 38 ms
52,096 KB |
testcase_05 | AC | 37 ms
51,968 KB |
testcase_06 | AC | 36 ms
52,096 KB |
testcase_07 | AC | 40 ms
51,968 KB |
testcase_08 | AC | 41 ms
52,224 KB |
testcase_09 | AC | 41 ms
52,096 KB |
testcase_10 | AC | 41 ms
51,968 KB |
testcase_11 | AC | 41 ms
52,608 KB |
testcase_12 | AC | 41 ms
52,352 KB |
testcase_13 | AC | 41 ms
51,840 KB |
testcase_14 | AC | 40 ms
51,968 KB |
testcase_15 | AC | 40 ms
52,352 KB |
testcase_16 | AC | 40 ms
52,352 KB |
testcase_17 | AC | 38 ms
51,968 KB |
testcase_18 | AC | 37 ms
51,968 KB |
testcase_19 | AC | 37 ms
52,224 KB |
testcase_20 | AC | 37 ms
51,968 KB |
testcase_21 | AC | 38 ms
51,968 KB |
testcase_22 | AC | 38 ms
52,224 KB |
testcase_23 | AC | 37 ms
52,224 KB |
testcase_24 | AC | 37 ms
51,968 KB |
testcase_25 | AC | 41 ms
52,224 KB |
testcase_26 | AC | 37 ms
52,352 KB |
testcase_27 | AC | 38 ms
51,968 KB |
testcase_28 | AC | 37 ms
52,352 KB |
testcase_29 | AC | 38 ms
52,524 KB |
testcase_30 | AC | 37 ms
52,224 KB |
testcase_31 | AC | 38 ms
52,196 KB |
testcase_32 | AC | 39 ms
52,096 KB |
testcase_33 | AC | 36 ms
52,224 KB |
testcase_34 | AC | 38 ms
52,096 KB |
testcase_35 | AC | 37 ms
51,968 KB |
testcase_36 | AC | 37 ms
52,224 KB |
testcase_37 | AC | 38 ms
51,968 KB |
testcase_38 | AC | 37 ms
52,480 KB |
testcase_39 | AC | 36 ms
52,352 KB |
testcase_40 | AC | 38 ms
52,224 KB |
testcase_41 | AC | 37 ms
52,352 KB |
testcase_42 | AC | 75 ms
77,184 KB |
testcase_43 | AC | 77 ms
77,696 KB |
testcase_44 | AC | 78 ms
77,612 KB |
testcase_45 | AC | 82 ms
77,312 KB |
testcase_46 | AC | 81 ms
77,696 KB |
testcase_47 | AC | 79 ms
77,552 KB |
testcase_48 | AC | 77 ms
77,824 KB |
testcase_49 | AC | 81 ms
77,440 KB |
testcase_50 | AC | 83 ms
77,440 KB |
testcase_51 | AC | 78 ms
77,440 KB |
testcase_52 | AC | 81 ms
77,824 KB |
testcase_53 | AC | 80 ms
77,312 KB |
testcase_54 | AC | 82 ms
77,184 KB |
testcase_55 | AC | 83 ms
77,564 KB |
testcase_56 | AC | 82 ms
77,544 KB |
testcase_57 | AC | 96 ms
93,080 KB |
testcase_58 | AC | 101 ms
92,928 KB |
testcase_59 | AC | 99 ms
93,696 KB |
testcase_60 | AC | 385 ms
114,048 KB |
testcase_61 | AC | 254 ms
100,352 KB |
testcase_62 | AC | 305 ms
102,400 KB |
testcase_63 | AC | 120 ms
93,056 KB |
testcase_64 | AC | 70 ms
86,400 KB |
testcase_65 | AC | 89 ms
93,312 KB |
testcase_66 | AC | 127 ms
93,992 KB |
testcase_67 | AC | 415 ms
119,424 KB |
testcase_68 | AC | 136 ms
94,080 KB |
testcase_69 | AC | 106 ms
93,084 KB |
testcase_70 | AC | 100 ms
93,260 KB |
testcase_71 | AC | 120 ms
93,616 KB |
testcase_72 | AC | 91 ms
93,440 KB |
testcase_73 | AC | 126 ms
93,440 KB |
testcase_74 | AC | 64 ms
83,328 KB |
testcase_75 | AC | 90 ms
93,056 KB |
testcase_76 | AC | 99 ms
93,112 KB |
testcase_77 | AC | 319 ms
102,016 KB |
testcase_78 | AC | 258 ms
95,872 KB |
testcase_79 | AC | 188 ms
94,592 KB |
testcase_80 | AC | 401 ms
122,240 KB |
testcase_81 | AC | 408 ms
128,384 KB |
testcase_82 | AC | 126 ms
94,464 KB |
testcase_83 | AC | 332 ms
108,544 KB |
testcase_84 | AC | 139 ms
93,952 KB |
testcase_85 | AC | 96 ms
93,824 KB |
testcase_86 | AC | 85 ms
93,568 KB |
ソースコード
import sys input = sys.stdin.readline sys.setrecursionlimit(10**5+1) 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")