結果

問題 No.3289 Make More Happy Connection
ユーザー miho-4
提出日時 2025-10-03 23:01:46
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 300 bytes
コンパイル時間 505 ms
コンパイル使用メモリ 82,908 KB
実行使用メモリ 107,936 KB
最終ジャッジ日時 2025-10-03 23:01:55
合計ジャッジ時間 7,050 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 1 WA * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

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=0,0
	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))
0