結果
問題 |
No.120 傾向と対策:門松列(その1)
|
ユーザー |
|
提出日時 | 2020-04-03 14:51:49 |
言語 | Rust (1.83.0 + proconio) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,025 bytes |
コンパイル時間 | 24,242 ms |
コンパイル使用メモリ | 378,280 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-03 00:43:24 |
合計ジャッジ時間 | 15,234 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | WA * 4 |
ソースコード
use std::io::*; fn main() { let mut s: String = String::new(); std::io::stdin().read_to_string(&mut s).ok(); let mut itr = s.trim().split_whitespace(); let t: usize = itr.next().unwrap().parse().unwrap(); let mut out = Vec::new(); for _ in 0..t { let n: usize = itr.next().unwrap().parse().unwrap(); let mut a: Vec<usize> = (0..n) .map(|_| itr.next().unwrap().parse().unwrap()) .collect(); a.sort(); let mut ans = 0; let mut used = vec![false; n]; for i in 0..n { for j in i + 1..n { for k in j + 1..n { if a[i] != a[j] && a[j] != a[k] && !used[i] && !used[j] && !used[k] { ans += 1; used[i] = true; used[j] = true; used[k] = true; } } } } writeln!(out, "{}", ans).ok(); } stdout().write_all(&out).unwrap(); }