結果

問題 No.488 四角関係
ユーザー miraxialmiraxial
提出日時 2017-02-24 23:26:18
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 303 bytes
コンパイル時間 580 ms
コンパイル使用メモリ 11,356 KB
実行使用メモリ 16,240 KB
最終ジャッジ日時 2023-08-30 23:50:24
合計ジャッジ時間 3,586 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 81 ms
15,220 KB
testcase_09 AC 79 ms
15,328 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 79 ms
15,136 KB
testcase_18 AC 80 ms
15,276 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 79 ms
15,172 KB
testcase_22 AC 80 ms
15,260 KB
testcase_23 WA -
testcase_24 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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