Submission #1442765


Source Code Expand

let rec search x y m cd index ans = 
if cd = [] 
then 
    ans
else
    let (c,d) = (List.hd cd)  in
    let dis = abs(x-c) + abs(y-d) in
    if dis <= m 
    then
        search x y dis (List.tl cd) (index-1) index
    else
        search x y m (List.tl cd) (index-1) ans;;


let n,m = Scanf.scanf "%d %d " (fun a b -> a,b) in 
let rec loop i= 
    if i <= 0 
    then
         [] 
    else
        (Scanf.scanf "%d %d " (fun a b -> a,b)) :: loop (i-1) in
let ab = List.rev (loop n) in 
let cd = loop m in
let rec loop2 ls = 
    match ls with
        |[] -> () 
        |(a,b)::tail ->  Printf.printf "%d\n" (search a b 1000000000 cd m 0);loop2 tail in
loop2 ab;;

Submission Info

Submission Time
Task A - Remaining Time
User niyarin
Language OCaml (4.02.3)
Score 0
Code Size 692 Byte
Status RE
Exec Time 1 ms
Memory 384 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 100
Status
RE × 3
WA × 1
RE × 9
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All sample_01.txt, sample_02.txt, sample_03.txt, subtask_1_1.txt, subtask_1_2.txt, subtask_1_3.txt, subtask_1_4.txt, subtask_1_5.txt, subtask_1_6.txt, subtask_1_7.txt
Case Name Status Exec Time Memory
sample_01.txt RE 1 ms 384 KB
sample_02.txt RE 1 ms 384 KB
sample_03.txt RE 1 ms 384 KB
subtask_1_1.txt RE 1 ms 384 KB
subtask_1_2.txt RE 1 ms 384 KB
subtask_1_3.txt RE 1 ms 384 KB
subtask_1_4.txt WA 1 ms 384 KB
subtask_1_5.txt RE 1 ms 384 KB
subtask_1_6.txt RE 1 ms 384 KB
subtask_1_7.txt RE 1 ms 384 KB