We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2264d85 commit bb72d63Copy full SHA for bb72d63
atcoder/rust/typical90/src/bin/070.rs
@@ -5,15 +5,26 @@ use std::collections::*;
5
use std::io::Write;
6
use std::ops::Bound::*;
7
8
-use itertools::*;
9
use itertools::__std_iter::once;
+use itertools::*;
10
use itertools_num::ItertoolsNum;
11
-use proconio::*;
12
use proconio::marker::*;
+use proconio::*;
13
use superslice::*;
14
15
fn main() {
16
input! {
17
+ n: usize,
18
+ xy: [(i128, i128); n],
19
+ }
20
+
21
+ let fac_x = xy.iter().map(|(x, _)| x).sorted().nth(n / 2).unwrap();
22
+ let fac_y = xy.iter().map(|(_, y)| y).sorted().nth(n / 2).unwrap();
23
24
+ let mut total = 0;
25
+ for (x, y) in xy.iter() {
26
+ total += (x - fac_x).abs() + (y - fac_y).abs();
27
}
28
29
+ println!("{}", total);
30
0 commit comments