結果
| 問題 | No.647 明太子 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-03-01 14:07:10 |
| 言語 | Haskell (9.10.1) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 905 bytes |
| 記録 | |
| コンパイル時間 | 10,075 ms |
| コンパイル使用メモリ | 199,984 KB |
| 実行使用メモリ | 421,888 KB |
| 最終ジャッジ日時 | 2024-12-26 08:18:56 |
| 合計ジャッジ時間 | 16,323 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 19 MLE * 1 |
コンパイルメッセージ
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
ソースコード
import Control.Applicative ((<$>))
import Control.Monad (when, forM_)
import qualified Data.Vector as V
import Data.Vector (Vector, (!))
import qualified Data.Vector.Mutable as VM
import Data.Vector.Mutable (IOVector)
main :: IO ()
main = do
n <- readLn
vab <- V.generateM n f
m <- readLn
vxy <- V.generateM m f
vc <- VM.replicate m 0 :: IO (IOVector Int)
forM_ [0..n-1] $ \i -> do
let (a, b) = vab ! i
forM_ [0..m-1] $ \j -> do
let (x, y) = vxy ! j
when (a >= x && b <= y) $ VM.modify vc (+1) j
vc' <- V.freeze vc
pr $ snd $ V.ifoldl' g (0, []) vc'
where
f _ = do
[l, m] <- map read <$> words <$> getLine :: IO [Int]
return (l, m)
g (mx, ls) i v
| v == 0 = (mx, ls)
| v > mx = (v, [i+1])
| v == mx = (mx, (i+1) : ls)
| otherwise = (mx, ls)
pr ls
| null ls = print 0
| otherwise = mapM_ print $ reverse ls