結果

問題 No.3286 Make a Happy Connection
コンテスト
ユーザー loglong
提出日時 2025-11-11 06:11:48
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 288 bytes
コンパイル時間 344 ms
コンパイル使用メモリ 12,160 KB
実行使用メモリ 10,496 KB
最終ジャッジ日時 2025-11-11 06:11:51
合計ジャッジ時間 2,784 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = list(map(int, input().split()))
dist = {}
idx = {}
for i in range(n):
    if a[i] not in idx:
        idx[a[i]] = i
    elif a[i] not in dist:
        dist[a[i]] = i - idx[a[i]]

for d in dist.values():
    if d <= 2:
        print("Yes")
        exit(0)
print("No")
0