結果

問題 No.488 四角関係
ユーザー aimyaimy
提出日時 2017-06-24 17:34:58
言語 Haskell
(9.8.2)
結果
TLE  
実行時間 -
コード長 445 bytes
コンパイル時間 2,058 ms
コンパイル使用メモリ 170,368 KB
実行使用メモリ 13,888 KB
最終ジャッジ日時 2024-04-14 22:36:10
合計ジャッジ時間 18,533 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 837 ms
8,192 KB
testcase_01 AC 1,236 ms
8,064 KB
testcase_02 AC 1,311 ms
7,936 KB
testcase_03 AC 351 ms
7,936 KB
testcase_04 AC 713 ms
8,064 KB
testcase_05 AC 2,565 ms
8,192 KB
testcase_06 AC 1,938 ms
8,064 KB
testcase_07 TLE -
testcase_08 -- -
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 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.8.2/environments/default
[1 of 2] Compiling Main             ( Main.hs, Main.o )
[2 of 2] Linking a.out

ソースコード

diff #

import Data.List
import Control.Monad

main = do
 [n,_] <- map read . words <$> getLine
 abs <- map (map read . words) . lines <$> getContents
 print (shikaku n abs)

shikaku n abs = length $ do
 v1 <- [0 .. n-1]
 v2 <- [v1+1 .. n-1]
 v3 <- [v2+1 .. n-1]
 v4 <- [v3+1 .. n-1]
 let cand = [v1,v2,v3,v4]
 let es = filter (\[a,b] -> elem a cand && elem b cand) abs
 guard $ length es == 4
 guard $ map length (group (sort (concat es))) == [2,2,2,2]
0