結果
問題 |
No.3289 Make More Happy Connection
|
ユーザー |
|
提出日時 | 2025-10-03 22:54:54 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 700 bytes |
コンパイル時間 | 320 ms |
コンパイル使用メモリ | 82,492 KB |
実行使用メモリ | 77,168 KB |
最終ジャッジ日時 | 2025-10-03 22:55:02 |
合計ジャッジ時間 | 7,281 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 WA * 6 |
ソースコード
import sys sys.setrecursionlimit(10**7) def ii(): return int(input()) def mi(d=0): return map(lambda x:int(x)-d,input().split()) INF = float("inf") MOD = 998244353 def answer(s): print(s) exit() def cross(xy): x,y = xy return (x+1,y),(x-1,y),(x,y+1),(x,y-1) ################################################ n = ii() back = [-1,-1] score = [0,0] for _ in range(n): x,y = mi() nb = [-1,-1] ns = [0,0] if x == y: ns[0] += x ns[1] += x i = 0 for x,y in ((x,y),(y,x)): if x in back: ns[i] = max(score[back.index(x)] + x,max(score)) else: ns[i] = max(score) nb[i] = y i += 1 back = nb score = ns print(max(score))