結果

問題 No.754 畳み込みの和
ユーザー LeonardoneLeonardone
提出日時 2018-12-02 04:43:17
言語 Haskell
(9.6.2)
結果
AC  
実行時間 723 ms / 5,000 ms
コード長 318 bytes
コンパイル時間 2,338 ms
コンパイル使用メモリ 157,972 KB
実行使用メモリ 162,864 KB
最終ジャッジ日時 2023-09-09 23:19:20
合計ジャッジ時間 5,909 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 723 ms
162,864 KB
testcase_01 AC 723 ms
162,848 KB
testcase_02 AC 722 ms
162,752 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 )
[2 of 2] Linking a.out

ソースコード

diff #

-- Try yukicoder
-- author: Leonardone @ NEETSDKASU

main = interact $ show . solve . map read . words

mod109 = (`mod` (10^9 + 7))

solve (n:vs) = ans where
    (xs, ys) = splitAt (n+1) vs 
    zs = zip xs (reverse ys)
    ans = fst $ foldl f (0, 0) zs
    f (a, s) (x, y) = (mod109 $ a + y * (s + x), mod109 $ s + x)
0