結果
| 問題 |
No.629 グラフの中に眠る門松列
|
| コンテスト | |
| ユーザー |
horiesiniti
|
| 提出日時 | 2018-03-13 16:04:11 |
| 言語 | Ruby (3.4.1) |
| 結果 |
AC
|
| 実行時間 | 182 ms / 4,000 ms |
| コード長 | 441 bytes |
| コンパイル時間 | 41 ms |
| コンパイル使用メモリ | 7,552 KB |
| 実行使用メモリ | 12,544 KB |
| 最終ジャッジ日時 | 2024-11-22 05:25:32 |
| 合計ジャッジ時間 | 5,847 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 6 |
| other | AC * 36 |
コンパイルメッセージ
Syntax OK
ソースコード
def f(a,b,c)
if a==b || a==c || b==c
return 0
end
if a<b && b>c
return 1
elsif a>b && b<c
return 1
else
return 0
end
end
n,m=gets.split.map{|e| e.to_i}
x=gets.split.map{|e| e.to_i}
y=n.times.map{[]}
m.times{
a,b=gets.split.map{|e| e.to_i-1}
y[a]<<b
y[b]<<a
}
ans=0
n.times{|i|
y[i].size.times{|p1|
((p1+1)..(y[i].size-1)).each{|p2|
ans+=f(x[y[i][p1]],x[i],x[y[i][p2]])
}
}
}
if ans>0
puts "YES"
else
puts "NO"
end
horiesiniti