結果

問題 No.488 四角関係
ユーザー cielciel
提出日時 2017-02-27 11:52:45
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 357 bytes
コンパイル時間 207 ms
コンパイル使用メモリ 11,284 KB
実行使用メモリ 15,980 KB
最終ジャッジ日時 2023-09-02 12:39:04
合計ジャッジ時間 20,930 ms
ジャッジサーバーID
(参考情報)
judge11 / judge16
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,207 ms
15,980 KB
testcase_01 AC 1,043 ms
15,972 KB
testcase_02 AC 1,252 ms
15,872 KB
testcase_03 AC 485 ms
15,900 KB
testcase_04 AC 761 ms
15,748 KB
testcase_05 AC 1,797 ms
15,764 KB
testcase_06 AC 2,316 ms
15,972 KB
testcase_07 AC 3,920 ms
15,672 KB
testcase_08 TLE -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

#!/usr/bin/ruby
h=Hash.new{|h,k|h[k]=[]}
n,m=gets.split.map(&:to_i)
m.times{
	x,y=gets.split.map(&:to_i)
	h[x]<<y
	h[y]<<x
}
p [*0..n].combination(4).count{|a0|
	a0.permutation.any?{|a|
		h[a[0]].include?(a[1]) &&
		h[a[1]].include?(a[2]) &&
		h[a[2]].include?(a[3]) &&
		h[a[3]].include?(a[0]) &&
		!h[a[0]].include?(a[2]) &&
		!h[a[1]].include?(a[3])
	}
}
0