結果
問題 | No.488 四角関係 |
ユーザー |
![]() |
提出日時 | 2017-06-26 18:47:40 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 133 ms / 5,000 ms |
コード長 | 417 bytes |
コンパイル時間 | 65 ms |
コンパイル使用メモリ | 7,552 KB |
実行使用メモリ | 16,640 KB |
最終ジャッジ日時 | 2024-10-04 09:40:41 |
合計ジャッジ時間 | 3,263 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
コンパイルメッセージ
Syntax OK
ソースコード
require 'set' a=(0..50).map{[]} l="gets.split.map{|e| e.to_i}" n,m=eval l m.times{ d,e=eval l a[d]<<e a[e]<<d } ans=0 0.upto(n-1){|i| a[i]=a[i].select{|e| e>i } (i+1).upto(n-1){|j| b=Set.new(a[i]) c=Set.new(a[j]) d=b&c s=d.size if s>1 && !b.member?(j) then d.each{|e1| d.each{|e2| next if e1>=e2 if a[e1].index(e2)==nil then ans=ans+1 end } } end } } puts ans