Skip to content

Commit

Permalink
add write_and_erase.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
rchaser53 committed Oct 4, 2020
1 parent c2e3397 commit f84deca
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/write_and_erase.rs
@@ -0,0 +1,23 @@
#![allow(unused_imports)]
use proconio::input;
use proconio::marker::*;
use std::collections::HashMap;

fn main() {
input!{
n: usize,
vals: [usize;n]
}

let mut map = HashMap::new();
for v in vals {
let entry = map.entry(v).or_insert(false);
*entry = !(*entry);
}

let mut count = 0;
for (_, v) in map {
if v { count += 1; }
}
println!("{}", count);
}

0 comments on commit f84deca

Please sign in to comment.