Skip to content

Commit

Permalink
pakencamp-2020-day2 c
Browse files Browse the repository at this point in the history
  • Loading branch information
bouzuya committed Nov 16, 2021
1 parent 56857be commit fb4c46a
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions pakencamp-2020-day2/src/bin/c.rs
Expand Up @@ -2,9 +2,25 @@ use proconio::{input, marker::Usize1};

fn main() {
input! {
n: usize,
a: [Usize1; n],
};
let ans = n - a.len();
println!("{}", ans);
t: usize,
}
for _ in 0..t {
input! {
n: usize,
m: usize,
ab: [(Usize1, Usize1); m],
};
let mut is = vec![0; n];
let mut os = vec![0; n];
for (a, b) in ab {
os[a] += 1;
is[b] += 1;
}
let mut sum = 0_usize;
for (i, o) in is.into_iter().zip(os.into_iter()) {
sum += i.min(o);
}
let ans = m - sum;
println!("{}", ans);
}
}

0 comments on commit fb4c46a

Please sign in to comment.