結果
| 問題 |
No.1692 Expectations
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-01-08 18:00:07 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
AC
|
| 実行時間 | 26 ms / 2,000 ms |
| コード長 | 698 bytes |
| コンパイル時間 | 18,466 ms |
| コンパイル使用メモリ | 400,764 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-14 09:40:05 |
| 合計ジャッジ時間 | 17,378 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 20 |
ソースコード
fn main() {
let mut buf = String::new();
let mut input = {
use std::io::Read;
std::io::stdin().read_to_string(&mut buf).unwrap();
buf.split_whitespace()
};
let n: usize = input.next().unwrap().parse().unwrap();
let m: usize = input.next().unwrap().parse().unwrap();
let mut a: Vec<usize> = (0..n)
.map(|_| input.next().unwrap().parse().unwrap())
.collect();
a.sort();
let mut count = vec![0; m];
for i in 0..n {
let j = a[i] - 1;
count[j] += 1
}
let max = count.iter().filter(|&&x| x >= 1).count();
let min = if m - n == 0 && max == 1 { 1 } else { 0 };
println!("{} {}", max, min);
}