結果

問題 No.488 四角関係
ユーザー miraxialmiraxial
提出日時 2017-02-24 23:37:13
言語 Ruby
(3.4.1)
結果
AC  
実行時間 143 ms / 5,000 ms
コード長 309 bytes
コンパイル時間 338 ms
コンパイル使用メモリ 8,064 KB
実行使用メモリ 13,824 KB
最終ジャッジ日時 2025-01-03 00:37:25
合計ジャッジ時間 3,562 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
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=a[i]&a[e]
    cc=0
    gg.each do |ee|
      cc+=(gg-[ee]).count{|i|!a[ee].include?(i)}
    end
    c+=cc/2
  end
end
p c/4
0