結果

問題 No.488 四角関係
ユーザー cielciel
提出日時 2017-02-27 11:54:41
言語 Ruby
(3.3.0)
結果
AC  
実行時間 2,919 ms / 5,000 ms
コード長 375 bytes
コンパイル時間 70 ms
コンパイル使用メモリ 11,400 KB
実行使用メモリ 15,552 KB
最終ジャッジ日時 2023-09-02 12:39:24
合計ジャッジ時間 12,153 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 570 ms
15,396 KB
testcase_01 AC 462 ms
15,504 KB
testcase_02 AC 566 ms
15,284 KB
testcase_03 AC 248 ms
15,540 KB
testcase_04 AC 355 ms
15,368 KB
testcase_05 AC 736 ms
15,272 KB
testcase_06 AC 1,065 ms
15,436 KB
testcase_07 AC 1,491 ms
15,364 KB
testcase_08 AC 2,919 ms
15,368 KB
testcase_09 AC 84 ms
15,036 KB
testcase_10 AC 187 ms
15,552 KB
testcase_11 AC 90 ms
15,544 KB
testcase_12 AC 142 ms
15,492 KB
testcase_13 AC 179 ms
15,404 KB
testcase_14 AC 103 ms
15,480 KB
testcase_15 AC 90 ms
15,276 KB
testcase_16 AC 85 ms
15,128 KB
testcase_17 AC 86 ms
15,120 KB
testcase_18 AC 87 ms
15,208 KB
testcase_19 AC 87 ms
15,188 KB
testcase_20 AC 85 ms
15,180 KB
testcase_21 AC 86 ms
15,164 KB
testcase_22 AC 87 ms
15,260 KB
testcase_23 AC 83 ms
15,176 KB
testcase_24 AC 86 ms
15,208 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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[0,3].permutation.any?{|a|
		a+=[a0[3]]
		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