結果
| 問題 |
No.488 四角関係
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-02-25 23:37:21 |
| 言語 | Ruby (3.4.1) |
| 結果 |
AC
|
| 実行時間 | 2,381 ms / 5,000 ms |
| コード長 | 462 bytes |
| コンパイル時間 | 61 ms |
| コンパイル使用メモリ | 7,424 KB |
| 実行使用メモリ | 12,416 KB |
| 最終ジャッジ日時 | 2024-06-11 15:15:32 |
| 合計ジャッジ時間 | 8,398 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
コンパイルメッセージ
Syntax OK
ソースコード
n,m = gets.chomp.split.map(&:to_i)
e=(0...n).map{|x| [x, []]}.to_h
m.times.map {
u,v=gets.split.map(&:to_i)
e[u] << v
e[v] << u
}
ans=0
(0...n).to_a.combination(4) {|xs|
u = xs[0]
rest = xs[1..-1]
rest.permutation(3) { |ys|
next unless e[u].index ys[0]
next unless e[ys[0]].index ys[1]
next unless e[ys[1]].index ys[2]
next unless e[ys[2]].index u
next if e[u].index ys[1]
next if e[ys[0]].index ys[2]
ans+=1
}
}
p ans/2