結果
| 問題 |
No.1468 Colourful Pastel
|
| ユーザー |
|
| 提出日時 | 2021-04-19 20:00:22 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
AC
|
| 実行時間 | 41 ms / 1,000 ms |
| コード長 | 1,491 bytes |
| コンパイル時間 | 15,677 ms |
| コンパイル使用メモリ | 392,040 KB |
| 実行使用メモリ | 11,228 KB |
| 最終ジャッジ日時 | 2024-07-04 05:02:46 |
| 合計ジャッジ時間 | 16,504 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 |
ソースコード
use std::collections::*;
#[allow(unused)]
struct Scanner {
stack: VecDeque<String>,
input: std::io::Stdin,
}
impl Scanner {
fn new() -> Scanner {
Scanner {
stack: VecDeque::<String>::new(),
input: std::io::stdin(),
}
}
fn take(&mut self) -> Option<String> {
if let Some(s) = self.stack.pop_front() {
return Some(s);
}
self.enqueue_from_line();
self.stack.pop_front()
}
fn enqueue_from_line(&mut self) {
let mut t = String::new();
self.input.read_line(&mut t).ok();
t.trim()
.split_ascii_whitespace()
.for_each(|s| self.stack.push_back(s.to_owned()));
}
}
macro_rules! scan {
($io:expr => $t:ty) => {
$io.take().unwrap().parse::<$t>().unwrap()
};
($io:expr => $t:tt * $n:expr) => ((0..$n).map(|_| scan!($io => $t)).collect::<Vec<_>>());
($io:expr => $($t:tt),*) => (($(scan!($io => $t)),*));
}
fn main() {
let mut cin = Scanner::new();
let n = scan!(cin => i32);
let aa = scan!(cin => String * n);
let mut map = btree_map::BTreeMap::<String, i32>::new();
for e in aa {
let v = map.get(&e).unwrap_or(&0) + 1;
map.insert(e, v);
}
let bb = scan!(cin => String * (n-1));
for e in bb {
let v = map.get(&e).unwrap_or(&0) - 1;
map.insert(e, v);
}
for (k, v) in map {
if v > 0 {
println!("{}", k);
}
}
}