結果

問題 No.488 四角関係
ユーザー miraxialmiraxial
提出日時 2017-02-24 23:37:13
言語 Ruby
(3.2.2)
結果
AC  
実行時間 132 ms / 5,000 ms
コード長 309 bytes
コンパイル時間 499 ms
コンパイル使用メモリ 11,476 KB
実行使用メモリ 15,964 KB
最終ジャッジ日時 2023-08-31 00:11:12
合計ジャッジ時間 3,760 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
15,160 KB
testcase_01 AC 97 ms
15,704 KB
testcase_02 AC 83 ms
15,312 KB
testcase_03 AC 84 ms
15,408 KB
testcase_04 AC 86 ms
15,552 KB
testcase_05 AC 96 ms
15,876 KB
testcase_06 AC 82 ms
15,412 KB
testcase_07 AC 132 ms
15,964 KB
testcase_08 AC 80 ms
15,028 KB
testcase_09 AC 77 ms
15,272 KB
testcase_10 AC 79 ms
15,152 KB
testcase_11 AC 78 ms
15,068 KB
testcase_12 AC 81 ms
15,488 KB
testcase_13 AC 79 ms
15,064 KB
testcase_14 AC 77 ms
15,280 KB
testcase_15 AC 76 ms
15,024 KB
testcase_16 AC 76 ms
15,144 KB
testcase_17 AC 76 ms
15,248 KB
testcase_18 AC 78 ms
15,232 KB
testcase_19 AC 77 ms
15,284 KB
testcase_20 AC 76 ms
15,068 KB
testcase_21 AC 76 ms
15,172 KB
testcase_22 AC 76 ms
15,172 KB
testcase_23 AC 79 ms
15,208 KB
testcase_24 AC 76 ms
15,264 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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