Skip to content

Commit 2ae70cc

Browse files
committed
Add a test for ABC057-B
1 parent 77803d7 commit 2ae70cc

File tree

8 files changed

+65
-1
lines changed

8 files changed

+65
-1
lines changed

examples/abc057-b.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// https://atcoder.jp/contests/abc057/tasks/abc057_b
2+
3+
#![allow(clippy::many_single_char_names, clippy::try_err)]
4+
5+
use text_io::{read, try_read, try_scan};
6+
7+
fn main() {
8+
let n: usize = read!();
9+
let m: usize = read!();
10+
let abs = (0..n)
11+
.map(|_| (read!(), read!()))
12+
.collect::<Vec<(i64, i64)>>();
13+
let cds = (0..m)
14+
.map(|_| (read!(), read!()))
15+
.collect::<Vec<(i64, i64)>>();
16+
17+
for (a, b) in abs {
18+
let j = (0..m)
19+
.min_by_key(|&j| {
20+
let (c, d) = cds[j];
21+
(a - c).abs() + (b - d).abs()
22+
})
23+
.unwrap();
24+
println!("{}", j + 1);
25+
}
26+
}

examples/tests.ron

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@
3232
matching: Words,
3333
),
3434
"abc054-c": (
35-
name: "ABC045: C - One-stroke Path",
35+
name: "ABC054: C - One-stroke Path",
36+
matching: Words,
37+
),
38+
"abc057-b": (
39+
name: "ABC057: B - Checkpoints",
3640
matching: Words,
3741
),
3842
"arc084-c": (
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2 2
2+
2 0
3+
0 0
4+
-1 0
5+
1 0
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
3 4
2+
10 10
3+
-10 -10
4+
3 3
5+
1 2
6+
2 3
7+
3 5
8+
3 5
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
5 5
2+
-100000000 -100000000
3+
-100000000 100000000
4+
100000000 -100000000
5+
100000000 100000000
6+
0 0
7+
0 0
8+
100000000 100000000
9+
100000000 -100000000
10+
-100000000 100000000
11+
-100000000 -100000000
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2
2+
1
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
3
2+
1
3+
2
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
5
2+
4
3+
3
4+
2
5+
1

0 commit comments

Comments
 (0)