Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
30 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,14 @@ | ||
use proconio::{input, marker::Usize1}; | ||
use proconio::input; | ||
|
||
fn main() { | ||
input! { | ||
n: usize, | ||
a: [Usize1; n], | ||
}; | ||
let ans = n - a.len(); | ||
let c1 = n / 10_000; | ||
let n1 = n % 10_000; | ||
let c2 = n1 / 5_000; | ||
let n2 = n1 % 5_000; | ||
let c3 = n2 / 1_000; | ||
let ans = c1 + c2 + c3; | ||
println!("{}", ans); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,19 @@ | ||
use proconio::{input, marker::Usize1}; | ||
use proconio::input; | ||
|
||
fn main() { | ||
input! { | ||
n: usize, | ||
a: [Usize1; n], | ||
mut lr: [(usize, usize); n], | ||
}; | ||
let ans = n - a.len(); | ||
lr.sort_by_key(|&(_, r)| r); | ||
let mut count = 1; | ||
let mut p = lr[0].1; | ||
for (l, r) in lr.into_iter().skip(1) { | ||
if l >= p { | ||
count += 1; | ||
p = r; | ||
} | ||
} | ||
let ans = count; | ||
println!("{}", ans); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,18 @@ | ||
use proconio::{input, marker::Usize1}; | ||
use proconio::input; | ||
|
||
fn main() { | ||
input! { | ||
n: usize, | ||
a: [Usize1; n], | ||
mut a: [i64; n], | ||
mut b: [i64; n], | ||
}; | ||
let ans = n - a.len(); | ||
a.sort(); | ||
b.sort(); | ||
let ans = a | ||
.iter() | ||
.copied() | ||
.zip(b.iter().copied()) | ||
.map(|(a, b)| (a - b).abs()) | ||
.sum::<i64>(); | ||
println!("{}", ans); | ||
} |