結果
問題 | No.91 赤、緑、青の石 |
ユーザー |
|
提出日時 | 2018-05-11 16:05:52 |
言語 | Haskell (9.10.1) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 589 bytes |
コンパイル時間 | 5,338 ms |
コンパイル使用メモリ | 170,496 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-24 07:14:27 |
合計ジャッジ時間 | 6,350 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 28 |
コンパイルメッセージ
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
ソースコード
importControl.Applicative(<$>)importData.Listsortmain::IO()main = solve <$> map read <$> words <$> getLine >>= printsolve::Int->Intsolve xs = bsearch (judge (a, b, c)) a cwhere [a, b, c] = sort xsbsearch::Int->Bool->Int->Int->Intbsearch f o n | n - o <= 1 = o| f m = bsearch f m n| otherwise = bsearch f o mwhere m = (o + n) `div` 2judge::IntIntInt->Int->Booljudge (a, b, c) m = (m > b && 2*m - a - b <= (c - m) `div` 2) ||(m <= b && m - a <= (b - m) `div` 2 + (c - m) `div` 2)