結果
| 問題 | No.1194 Replace |
| コンテスト | |
| ユーザー |
titia
|
| 提出日時 | 2020-08-22 16:41:58 |
| 言語 | Python3 (3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL) |
| 結果 |
WA
不安定
|
| 実行時間 | - |
| コード長 | 580 bytes |
| 記録 | |
| コンパイル時間 | 55 ms |
| コンパイル使用メモリ | 15,104 KB |
| 実行使用メモリ | 47,628 KB |
| 最終ジャッジ日時 | 2026-09-18 04:48:45 |
| 合計ジャッジ時間 | 12,708 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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)
titia