結果
問題 |
No.1194 Replace
|
ユーザー |
![]() |
提出日時 | 2020-08-22 16:41:58 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 580 bytes |
コンパイル時間 | 228 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 47,436 KB |
最終ジャッジ日時 | 2024-10-15 10:35:49 |
合計ジャッジ時間 | 14,881 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 6 WA * 21 |
ソースコード
import sys input = sys.stdin.readline from operator import itemgetter N,M=map(int,input().split()) E=[tuple(map(int,input().split())) for i in range(M)] E.sort(key=itemgetter(1),reverse=True) SCORE=dict() for x,y in E: if x in SCORE and y in SCORE: if SCORE[x]<SCORE[y]: SCORE[x]=SCORE[y] elif x in SCORE: if SCORE[x]<y: SCORE[x]=y elif y in SCORE: if x<SCORE[y]: SCORE[x]=SCORE[y] else: if x<y: SCORE[x]=y ANS=N*(N+1)//2 for x in SCORE: ANS+=SCORE[x]-x print(ANS)