結果
問題 | No.1290 Addition and Subtraction Operation |
ユーザー | persimmon-persimmon |
提出日時 | 2021-02-18 11:27:46 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 742 bytes |
コンパイル時間 | 351 ms |
コンパイル使用メモリ | 87,156 KB |
実行使用メモリ | 164,136 KB |
最終ジャッジ日時 | 2023-10-12 20:06:26 |
合計ジャッジ時間 | 12,372 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 77 ms
75,752 KB |
testcase_01 | AC | 79 ms
71,416 KB |
testcase_02 | AC | 79 ms
71,532 KB |
testcase_03 | AC | 78 ms
71,468 KB |
testcase_04 | AC | 80 ms
71,548 KB |
testcase_05 | AC | 81 ms
71,368 KB |
testcase_06 | AC | 78 ms
71,300 KB |
testcase_07 | AC | 79 ms
71,428 KB |
testcase_08 | AC | 80 ms
71,656 KB |
testcase_09 | AC | 79 ms
71,176 KB |
testcase_10 | AC | 78 ms
71,476 KB |
testcase_11 | AC | 79 ms
71,464 KB |
testcase_12 | AC | 79 ms
71,320 KB |
testcase_13 | AC | 79 ms
71,576 KB |
testcase_14 | AC | 78 ms
71,480 KB |
testcase_15 | AC | 79 ms
71,424 KB |
testcase_16 | AC | 79 ms
71,536 KB |
testcase_17 | AC | 79 ms
71,428 KB |
testcase_18 | AC | 79 ms
71,360 KB |
testcase_19 | AC | 78 ms
71,620 KB |
testcase_20 | AC | 78 ms
71,596 KB |
testcase_21 | AC | 78 ms
71,416 KB |
testcase_22 | AC | 80 ms
71,264 KB |
testcase_23 | AC | 79 ms
71,532 KB |
testcase_24 | AC | 79 ms
71,464 KB |
testcase_25 | AC | 80 ms
71,676 KB |
testcase_26 | AC | 79 ms
71,364 KB |
testcase_27 | AC | 80 ms
71,328 KB |
testcase_28 | AC | 78 ms
71,432 KB |
testcase_29 | AC | 78 ms
71,396 KB |
testcase_30 | AC | 79 ms
71,508 KB |
testcase_31 | AC | 78 ms
71,404 KB |
testcase_32 | AC | 79 ms
71,576 KB |
testcase_33 | AC | 78 ms
71,468 KB |
testcase_34 | AC | 77 ms
71,300 KB |
testcase_35 | AC | 78 ms
71,552 KB |
testcase_36 | AC | 79 ms
71,628 KB |
testcase_37 | AC | 76 ms
71,400 KB |
testcase_38 | AC | 77 ms
71,584 KB |
testcase_39 | AC | 79 ms
71,328 KB |
testcase_40 | AC | 78 ms
71,432 KB |
testcase_41 | AC | 79 ms
71,620 KB |
testcase_42 | TLE | - |
testcase_43 | -- | - |
testcase_44 | -- | - |
testcase_45 | -- | - |
testcase_46 | -- | - |
testcase_47 | -- | - |
testcase_48 | -- | - |
testcase_49 | -- | - |
testcase_50 | -- | - |
testcase_51 | -- | - |
testcase_52 | -- | - |
testcase_53 | -- | - |
testcase_54 | -- | - |
testcase_55 | -- | - |
testcase_56 | -- | - |
testcase_57 | -- | - |
testcase_58 | -- | - |
testcase_59 | -- | - |
testcase_60 | -- | - |
testcase_61 | -- | - |
testcase_62 | -- | - |
testcase_63 | -- | - |
testcase_64 | -- | - |
testcase_65 | -- | - |
testcase_66 | -- | - |
testcase_67 | -- | - |
testcase_68 | -- | - |
testcase_69 | -- | - |
testcase_70 | -- | - |
testcase_71 | -- | - |
testcase_72 | -- | - |
testcase_73 | -- | - |
testcase_74 | -- | - |
testcase_75 | -- | - |
testcase_76 | -- | - |
testcase_77 | -- | - |
testcase_78 | -- | - |
testcase_79 | -- | - |
testcase_80 | -- | - |
testcase_81 | -- | - |
testcase_82 | -- | - |
testcase_83 | -- | - |
testcase_84 | -- | - |
testcase_85 | -- | - |
testcase_86 | -- | - |
ソースコード
import sys input=sys.stdin.readline def main2(n,m,b_,lr): from heapq import heappop,heappush b=[x*(-1)**i for i,x in enumerate(b_)] lr.sort(key=lambda x:x[0]) ary=[0]*(n+1) now=0 for i in range(n): now-=ary[i] stc=[] mir=n d=0 while lr and lr[0][0]-1==i: l,r=heappop(lr) stc.append(r) mir=min(mir,r) d=b[i]-now ary[mir]+=d for r in stc: if r==mir:continue heappush(lr,[mir+1,r]) now+=d if b[i]==now: pass else: return False return True if __name__=='__main__': n,m=map(int,input().split()) b=list(map(int,input().split())) lr=[list(map(int,input().split())) for _ in range(m)] ret2=main2(n,m,b,lr) print('YES' if ret2 else 'NO')