結果
| 問題 | No.3286 Make a Happy Connection | 
| コンテスト | |
| ユーザー |  kona0001 | 
| 提出日時 | 2025-08-25 02:41:36 | 
| 言語 | Ruby (3.4.1) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 85 ms / 2,000 ms | 
| コード長 | 336 bytes | 
| コンパイル時間 | 284 ms | 
| コンパイル使用メモリ | 8,064 KB | 
| 実行使用メモリ | 13,056 KB | 
| 最終ジャッジ日時 | 2025-10-03 20:50:15 | 
| 合計ジャッジ時間 | 4,702 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 27 | 
コンパイルメッセージ
Syntax OK
ソースコード
def assert f
  unless f
    puts "Error!: Constraint Violation"
    exit
  end
end
n = gets.to_i
a = gets.split.map(&:to_i)
assert(2 <= n && n <= 500)
a.each do |v|
  assert(1 <= v && v <= 100)
end
f = false
(n-1).times do |i|
  f = true if a[i] == a[i+1]
end
(n-2).times do |i|
  f = true if a[i] == a[i+2]
end
puts f ? "Yes" : "No"
            
            
            
        