Submission #3236649
Source Code Expand
let rec upper_bound l r p = if r <= 1 + l then l else let m = (l + r) / 2 in if p m then upper_bound m r p else upper_bound l m p let () = Scanf.scanf "%d\n" @@ fun n -> let lrs = Array.init n @@ fun _ -> Scanf.scanf "%d %d\n" @@ fun l r -> l, r in let f x = Array.fold_right (fun (l, r) -> ( + ) @@ if x < l then l - x else if r < x then x - r else 0) lrs 0 in Printf.printf "%d\n" @@ f @@ upper_bound (Array.fold_right (fun (l, _) -> min l) lrs max_int) (Array.fold_right (fun (_, r) -> max r) lrs 0 + 1) @@ fun x -> f (x - 1) >= f x
Submission Info
Submission Time | |
---|---|
Task | E - NarrowRectangles |
User | fetburner |
Language | OCaml (4.02.3) |
Score | 0 |
Code Size | 610 Byte |
Status | WA |
Exec Time | 150 ms |
Memory | 6784 KB |
Judge Result
Set Name | Sample | Subtask | All | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 300 | 0 / 700 | ||||||||||||
Status |
|
|
|
Set Name | Test Cases |
---|---|
Sample | 0_000.txt, 0_001.txt, 0_002.txt, 0_003.txt, 0_004.txt |
Subtask | 0_000, 0_001, 0_004, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt, 1_010.txt, 1_011.txt, 1_012.txt, 1_013.txt, 1_014.txt, 1_015.txt, 1_016.txt, 1_017.txt |
All | 0_000.txt, 0_001.txt, 0_002.txt, 0_003.txt, 0_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt, 1_010.txt, 1_011.txt, 1_012.txt, 1_013.txt, 1_014.txt, 1_015.txt, 1_016.txt, 1_017.txt, 2_018.txt, 2_019.txt, 2_020.txt, 2_021.txt, 2_022.txt, 2_023.txt, 2_024.txt, 2_025.txt, 2_026.txt, 2_027.txt, 2_028.txt, 2_029.txt, 2_030.txt, 2_031.txt, 2_032.txt, 2_033.txt, 2_034.txt, 2_035.txt, 2_036.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
0_000.txt | AC | 1 ms | 384 KB |
0_001.txt | AC | 1 ms | 384 KB |
0_002.txt | WA | 1 ms | 384 KB |
0_003.txt | AC | 1 ms | 384 KB |
0_004.txt | AC | 1 ms | 384 KB |
1_005.txt | AC | 1 ms | 1024 KB |
1_006.txt | WA | 1 ms | 1024 KB |
1_007.txt | AC | 1 ms | 1024 KB |
1_008.txt | WA | 1 ms | 896 KB |
1_009.txt | WA | 1 ms | 1024 KB |
1_010.txt | WA | 1 ms | 1024 KB |
1_011.txt | WA | 1 ms | 1024 KB |
1_012.txt | WA | 1 ms | 1024 KB |
1_013.txt | WA | 1 ms | 1024 KB |
1_014.txt | WA | 1 ms | 896 KB |
1_015.txt | WA | 1 ms | 1024 KB |
1_016.txt | WA | 1 ms | 1024 KB |
1_017.txt | WA | 1 ms | 1024 KB |
2_018.txt | AC | 111 ms | 6144 KB |
2_019.txt | WA | 109 ms | 6400 KB |
2_020.txt | AC | 112 ms | 6784 KB |
2_021.txt | WA | 148 ms | 6144 KB |
2_022.txt | WA | 148 ms | 6272 KB |
2_023.txt | WA | 149 ms | 6784 KB |
2_024.txt | WA | 150 ms | 6144 KB |
2_025.txt | WA | 150 ms | 6144 KB |
2_026.txt | WA | 149 ms | 6144 KB |
2_027.txt | WA | 148 ms | 6144 KB |
2_028.txt | WA | 148 ms | 6144 KB |
2_029.txt | WA | 149 ms | 6400 KB |
2_030.txt | WA | 149 ms | 6144 KB |
2_031.txt | WA | 139 ms | 6784 KB |
2_032.txt | WA | 142 ms | 6144 KB |
2_033.txt | WA | 141 ms | 6144 KB |
2_034.txt | WA | 141 ms | 6144 KB |
2_035.txt | WA | 147 ms | 6144 KB |
2_036.txt | AC | 124 ms | 6144 KB |