結果
問題 | No.2938 Sigma Sigma Distance Distance Problem |
ユーザー | torus711 |
提出日時 | 2024-10-18 21:37:07 |
言語 | Haskell (9.8.2) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,204 bytes |
コンパイル時間 | 20,465 ms |
コンパイル使用メモリ | 193,664 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-18 22:31:23 |
合計ジャッジ時間 | 19,085 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,816 KB |
testcase_01 | AC | 1 ms
6,820 KB |
testcase_02 | AC | 2 ms
6,816 KB |
testcase_03 | AC | 2 ms
6,820 KB |
testcase_04 | AC | 1 ms
6,816 KB |
testcase_05 | AC | 2 ms
6,816 KB |
testcase_06 | AC | 1 ms
6,820 KB |
testcase_07 | AC | 2 ms
6,820 KB |
testcase_08 | AC | 1 ms
6,816 KB |
testcase_09 | AC | 2 ms
6,816 KB |
testcase_10 | AC | 2 ms
6,816 KB |
testcase_11 | AC | 1 ms
6,820 KB |
testcase_12 | AC | 2 ms
6,816 KB |
testcase_13 | AC | 1 ms
6,820 KB |
testcase_14 | AC | 1 ms
6,816 KB |
testcase_15 | AC | 2 ms
6,820 KB |
testcase_16 | AC | 2 ms
6,816 KB |
testcase_17 | AC | 2 ms
6,816 KB |
testcase_18 | AC | 2 ms
6,816 KB |
testcase_19 | AC | 1 ms
6,816 KB |
testcase_20 | AC | 2 ms
6,816 KB |
testcase_21 | AC | 1 ms
6,820 KB |
04_evil_01.txt | RE | - |
04_evil_02.txt | RE | - |
04_evil_03.txt | RE | - |
04_evil_04.txt | RE | - |
04_evil_05.txt | RE | - |
04_evil_06.txt | RE | - |
04_evil_07.txt | RE | - |
04_evil_08.txt | RE | - |
04_evil_09.txt | RE | - |
04_evil_10.txt | RE | - |
04_evil_11.txt | RE | - |
04_evil_12.txt | RE | - |
04_evil_13.txt | RE | - |
04_evil_14.txt | RE | - |
04_evil_15.txt | RE | - |
04_evil_16.txt | RE | - |
04_evil_17.txt | RE | - |
04_evil_18.txt | RE | - |
04_evil_19.txt | RE | - |
04_evil_20.txt | RE | - |
コンパイルメッセージ
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
ソースコード
{-# LANGUAGE BangPatterns #-} {-# LANGUAGE BinaryLiterals #-} {-# LANGUAGE MultiWayIf #-} {-# LANGUAGE NumDecimals #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TupleSections #-} {-# LANGUAGE FlexibleContexts #-} {-# OPTIONS_GHC -O2 #-} {-# OPTIONS_GHC -Wno-tabs #-} import Control.Applicative import Control.Arrow import Control.Monad import Control.Monad.ST import Data.Char import Data.List import Data.Maybe import qualified Data.ByteString.Char8 as B import Data.Array import Data.Array.ST.Safe import Data.STRef import Debug.Trace import Text.Printf import System.Exit readInt = readLn :: IO Int readInteger = readLn :: IO Integer readInts = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine readIntegers = map ( fst . fromJust . B.readInteger ) . B.words <$> B.getLine which a b f = if f then a else b mp [ a, b ] = ( a, b ) modifyArray a i f = writeArray a i =<< f <$> readArray a i printList :: Show a => [a] -> IO () printList = putStrLn . intercalate " " . map show main = do n <- readInt when ( 100 < n ) exitFailure as <- listArray ( 1, n ) <$> readInts print $ sum $ do i <- [ 1 .. n ] j <- [ 1 .. n ] return $ abs ( i - j ) * abs ( as ! i - as ! j )