結果
問題 |
No.3289 Make More Happy Connection
|
ユーザー |
|
提出日時 | 2025-10-03 23:02:37 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 302 bytes |
コンパイル時間 | 383 ms |
コンパイル使用メモリ | 82,568 KB |
実行使用メモリ | 107,820 KB |
最終ジャッジ日時 | 2025-10-03 23:02:45 |
合計ジャッジ時間 | 8,090 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 2 |
other | AC * 1 WA * 23 |
ソースコード
n=int(input()) L=[list(map(int,input().split())) for _ in range(n)] l1,l2=L[0] s1,s2=0,0 for i in range(1,n): a,b=L[i] nx1,nx2=s1,s2 if a==l1: nx1=max(nx1,l1+a) if a==l2: nx1=max(nx1,l2+a) if b==l1: nx2=max(nx2,l1+b) if b==l2: nx2=max(nx2,l2+b) l1,l2=b,a s1,s2=nx1,nx2 print(max(s1,s2))