結果

問題 No.694 square1001 and Permutation 3
ユーザー konsin_tokagekonsin_tokage
提出日時 2018-06-24 00:02:44
言語 Haskell
(9.8.2)
結果
WA  
実行時間 -
コード長 315 bytes
コンパイル時間 3,896 ms
コンパイル使用メモリ 163,880 KB
実行使用メモリ 181,832 KB
最終ジャッジ日時 2023-09-13 08:37:58
合計ジャッジ時間 11,720 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 7 ms
11,668 KB
testcase_06 AC 7 ms
11,656 KB
testcase_07 WA -
testcase_08 TLE -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.6.1/environments/default
[1 of 2] Compiling Main             ( Main.hs, Main.o )
[2 of 2] Linking a.out

ソースコード

diff #

import Control.Monad
import qualified Data.Set as S
solve n a = take n $ scanl step r a
  where 
    ss@(s:_) = scanr S.insert S.empty a
    r = sum $ zipWith S.findIndex a ss
    step r x = r + (n-1) - S.findIndex x s * 2
main = do
  n <- readLn
  a <- replicateM n readLn :: IO [Integer]
  mapM_ print $ solve n a
0