結果
問題 | No.723 2つの数の和 |
ユーザー |
![]() |
提出日時 | 2022-12-16 20:08:59 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 17 ms / 2,000 ms |
コード長 | 481 bytes |
コンパイル時間 | 13,370 ms |
コンパイル使用メモリ | 403,924 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-16 01:04:11 |
合計ジャッジ時間 | 14,895 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
use std::collections::HashMap; fn main() { let mut xx = String::new(); std::io::Read::read_to_string(&mut std::io::stdin(), &mut xx).ok(); let xx: Vec<i64> = xx.split_whitespace().flat_map(str::parse).collect(); let mut count = HashMap::new(); for &x in &xx[2..] { *count.entry(x).or_insert(0u64) += 1; } let mut answer = 0; for &x in &xx[2..] { answer += count.get(&(xx[1] - x)).unwrap_or(&0); } println!("{answer}"); }