結果

問題 No.488 四角関係
ユーザー miraxial
提出日時 2017-02-24 23:26:18
言語 Ruby
(3.4.1)
結果
WA  
実行時間 -
コード長 303 bytes
コンパイル時間 152 ms
コンパイル使用メモリ 8,064 KB
実行使用メモリ 13,824 KB
最終ジャッジ日時 2025-01-02 23:57:30
合計ジャッジ時間 3,360 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 4 WA * 18
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n,m=gets.split.map &:to_i
a=Array.new(n).map{Array.new}
m.times do
  x,y=gets.split.map &:to_i
  a[x]<< y
  a[y]<< x
end
c=0
n.times do |i|
  g=[*0..n-1]-a[i]-[i]
  g.each do |e|
    gg=g&a[e]
    gg.each do |ee|
      cc=(gg-[ee]).count{|i|!a[ee].include?(i)}
      c+=cc*(cc-1)/2
    end
  end
end
p c
0