Submission #2586534


Source Code Expand

import Data.List
main=do
 [n,k]<-map read.words<$>getLine
 l<-reverse.sort.map read.words<$>getLine
 print$if k>sum l then -1 else solve k 0 l

solve::Int->Int->[Int]->Int
solve k y []=0
solve k y (x:xs)=if x+y<k then 1+(solve k (y+x) xs) else 1

Submission Info

Submission Time
Task A - Credits
User kotatsugame
Language Haskell (GHC 7.10.3)
Score 100
Code Size 253 Byte
Status AC
Exec Time 2 ms
Memory 764 KB

Judge Result

Set Name All
Score / Max Score 100 / 100
Status
AC × 18
Set Name Test Cases
All corner_10, corner_11, corner_12, corner_13, max_14, random_00, random_01, random_02, random_03, random_04, random_05, random_06, random_07, random_08, random_09, sample_00, sample_01, sample_02
Case Name Status Exec Time Memory
corner_10 AC 1 ms 508 KB
corner_11 AC 1 ms 508 KB
corner_12 AC 1 ms 508 KB
corner_13 AC 1 ms 508 KB
max_14 AC 2 ms 764 KB
random_00 AC 2 ms 508 KB
random_01 AC 2 ms 636 KB
random_02 AC 1 ms 508 KB
random_03 AC 2 ms 636 KB
random_04 AC 1 ms 508 KB
random_05 AC 2 ms 636 KB
random_06 AC 1 ms 508 KB
random_07 AC 2 ms 636 KB
random_08 AC 2 ms 636 KB
random_09 AC 2 ms 508 KB
sample_00 AC 1 ms 508 KB
sample_01 AC 1 ms 508 KB
sample_02 AC 1 ms 508 KB