結果

問題 No.139 交差点
ユーザー aimyaimy
提出日時 2017-04-18 12:28:44
言語 Haskell
(9.8.2)
結果
AC  
実行時間 6 ms / 5,000 ms
コード長 484 bytes
コンパイル時間 8,239 ms
コンパイル使用メモリ 163,576 KB
実行使用メモリ 11,032 KB
最終ジャッジ日時 2023-09-26 13:14:29
合計ジャッジ時間 4,556 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,924 KB
testcase_01 AC 3 ms
6,908 KB
testcase_02 AC 2 ms
6,956 KB
testcase_03 AC 3 ms
7,124 KB
testcase_04 AC 3 ms
7,560 KB
testcase_05 AC 3 ms
7,860 KB
testcase_06 AC 3 ms
7,204 KB
testcase_07 AC 4 ms
8,064 KB
testcase_08 AC 4 ms
7,996 KB
testcase_09 AC 4 ms
8,272 KB
testcase_10 AC 6 ms
11,032 KB
testcase_11 AC 3 ms
7,164 KB
testcase_12 AC 5 ms
9,556 KB
testcase_13 AC 3 ms
7,140 KB
testcase_14 AC 3 ms
7,748 KB
testcase_15 AC 4 ms
8,404 KB
testcase_16 AC 3 ms
7,068 KB
testcase_17 AC 4 ms
8,332 KB
testcase_18 AC 3 ms
7,708 KB
testcase_19 AC 4 ms
8,468 KB
testcase_20 AC 3 ms
7,248 KB
testcase_21 AC 3 ms
6,928 KB
testcase_22 AC 2 ms
6,888 KB
testcase_23 AC 4 ms
8,760 KB
testcase_24 AC 3 ms
6,960 KB
testcase_25 AC 3 ms
7,568 KB
testcase_26 AC 3 ms
7,540 KB
testcase_27 AC 3 ms
7,192 KB
testcase_28 AC 3 ms
7,064 KB
testcase_29 AC 4 ms
8,180 KB
testcase_30 AC 4 ms
8,436 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 #

main = do
 [_,l] <- map read . words <$> getLine
 xwts <- map (map read . words) . lines <$> getContents
 print (crossing l xwts)

crossing :: Int -> [[Int]] -> Int
crossing l = rest . foldl cross (0,0)
 where
  rest (t,d) = t + (l-d)
  cross (t',d') xwt@[x,w,t]
   | d' /= x = cross (t'+(x-d'),x) xwt
   | mod t' (2*t) >= t = cross (next,d') xwt
   | t - mod t' (2*t) < w = cross (next,d') xwt
   | otherwise = (t'+w,d'+w)
   where next = head (dropWhile (<t') (iterate (+ (2*t)) 0))
0