Submission #17594768
Source Code Expand
import qualified Data.ByteString.Char8 as C import Data.List import qualified Data.Vector.Unboxed as U import Data.Vector.Unboxed ((!)) main = sol <$> readLn <*> get <*> get <*> get >>= print get = U.fromList . sort . unfoldr (C.readInt . C.dropWhile (<'+')) <$> C.getLine sol n as bs cs = U.sum $ U.map f bs where f k = g k*(n - h k) g k = bsearch 0 (n+1) $ (<k) . (a!) h k = bsearch 0 (n+1) $ (<=k) . (c!) a = U.cons 0 $ U.snoc as m c = U.cons 0 $ U.snoc cs m m = 10^9+1 bsearch l r p | l >= r = l | p m = bsearch m r p | otherwise = bsearch l (m-1) p where m = (l+r+1) `div` 2
Submission Info
Submission Time | |
---|---|
Task | C - Snuke Festival |
User | karoyakani |
Language | Haskell (GHC 8.8.3) |
Score | 300 |
Code Size | 636 Byte |
Status | AC |
Exec Time | 481 ms |
Memory | 27668 KiB |
Compile Error
Loaded package environment from /home/contestant/.ghc/x86_64-linux-8.8.3/environments/default
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | s1.txt, s2.txt, s3.txt |
All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt, 27.txt, 28.txt, 29.txt, s1.txt, s2.txt, s3.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | AC | 472 ms | 26568 KiB |
02.txt | AC | 469 ms | 27600 KiB |
03.txt | AC | 456 ms | 25628 KiB |
04.txt | AC | 473 ms | 25432 KiB |
05.txt | AC | 425 ms | 24600 KiB |
06.txt | AC | 445 ms | 24528 KiB |
07.txt | AC | 389 ms | 24300 KiB |
08.txt | AC | 413 ms | 24308 KiB |
09.txt | AC | 292 ms | 21364 KiB |
10.txt | AC | 295 ms | 20428 KiB |
11.txt | AC | 202 ms | 20324 KiB |
12.txt | AC | 195 ms | 19068 KiB |
13.txt | AC | 455 ms | 27668 KiB |
14.txt | AC | 451 ms | 27596 KiB |
15.txt | AC | 474 ms | 27476 KiB |
16.txt | AC | 449 ms | 27592 KiB |
17.txt | AC | 471 ms | 27468 KiB |
18.txt | AC | 450 ms | 27580 KiB |
19.txt | AC | 481 ms | 27592 KiB |
20.txt | AC | 69 ms | 15060 KiB |
21.txt | AC | 72 ms | 15164 KiB |
22.txt | AC | 86 ms | 19736 KiB |
23.txt | AC | 448 ms | 27468 KiB |
24.txt | AC | 443 ms | 27464 KiB |
25.txt | AC | 439 ms | 27560 KiB |
26.txt | AC | 2 ms | 3972 KiB |
27.txt | AC | 2 ms | 3960 KiB |
28.txt | AC | 2 ms | 4064 KiB |
29.txt | AC | 2 ms | 3968 KiB |
s1.txt | AC | 2 ms | 3904 KiB |
s2.txt | AC | 2 ms | 4076 KiB |
s3.txt | AC | 2 ms | 4056 KiB |