結果

問題 No.647 明太子
ユーザー torus711torus711
提出日時 2018-04-07 00:18:51
言語 Haskell
(9.8.2)
結果
AC  
実行時間 182 ms / 4,500 ms
コード長 865 bytes
コンパイル時間 4,552 ms
コンパイル使用メモリ 161,544 KB
実行使用メモリ 23,564 KB
最終ジャッジ日時 2023-09-09 09:47:37
合計ジャッジ時間 5,649 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,932 KB
testcase_01 AC 3 ms
6,976 KB
testcase_02 AC 2 ms
6,984 KB
testcase_03 AC 2 ms
7,020 KB
testcase_04 AC 3 ms
7,088 KB
testcase_05 AC 3 ms
7,148 KB
testcase_06 AC 2 ms
7,056 KB
testcase_07 AC 3 ms
7,976 KB
testcase_08 AC 3 ms
7,824 KB
testcase_09 AC 12 ms
11,236 KB
testcase_10 AC 12 ms
11,296 KB
testcase_11 AC 12 ms
11,112 KB
testcase_12 AC 12 ms
11,312 KB
testcase_13 AC 22 ms
11,948 KB
testcase_14 AC 152 ms
21,520 KB
testcase_15 AC 32 ms
12,948 KB
testcase_16 AC 11 ms
11,472 KB
testcase_17 AC 162 ms
21,516 KB
testcase_18 AC 182 ms
21,528 KB
testcase_19 AC 72 ms
17,860 KB
testcase_20 AC 63 ms
16,436 KB
testcase_21 AC 32 ms
13,392 KB
testcase_22 AC 142 ms
23,564 KB
testcase_23 AC 7 ms
11,144 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.6.1/environments/default
[1 of 2] Compiling Main             ( Main.hs, Main.o )

Main.hs:22:1: warning: [GHC-94817] [-Wtabs]
    Tab character found here, and in 13 further locations.
    Suggested fix: Please use spaces instead.
   |
22 |         n <- readInt
   | ^^^^^^^^
[2 of 2] Linking a.out

ソースコード

diff #

{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE BangPatterns #-}

import Control.Applicative
import Control.Monad
import Control.Arrow
import Data.List
import Data.Maybe
import Data.Char
import qualified Data.ByteString.Char8 as B
import Text.Printf

readInt = ( readLn :: IO Int )
readInts = map ( read :: String -> Int ) . words <$> getLine

getList = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

main = do
	n <- readInt
	asbs <- map mp <$> replicateM n readInts
	m <- readInt
	xsys <- map mp <$> replicateM m readInts
	let
		nums = map ( bought_by asbs ) xsys
		ma = maximum nums
	if ma == 0
		then print 0
		else mapM_ print $ map fst $ filter ( ( == ma ) . snd ) $ zip [ 1 .. ] nums

bought_by asbs xy = length $ filter id $ map ( buy xy ) asbs

buy ( x, y ) ( a, b ) = x <= a && b <= y
0