結果

問題 No.1882 Areas of Triangle
ユーザー
提出日時 2024-07-02 18:13:19
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 18 ms / 2,000 ms
コード長 537 bytes
コンパイル時間 12,958 ms
コンパイル使用メモリ 379,408 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-02 18:13:33
合計ジャッジ時間 14,202 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::{cmp::Ordering, io::Read};

fn main() {
	let mut s = String::new();
	std::io::stdin().read_to_string(&mut s).ok();
	let l: Vec<_> = s.lines().collect();
	let n: Vec<usize> = l[0].split(' ').flat_map(str::parse).collect();
	let mut a: Vec<usize> = l[1].split(' ').flat_map(str::parse).collect();
	a.sort();
	a.reverse();
	let mut x = 0;
	for &i in &a {
		x += match a.binary_search_by(|a| match (2 * n[1]).cmp(&(i * a)) {
			Ordering::Equal => Ordering::Less,
			o => o,
		}) {
			Ok(j) | Err(j) => j,
		};
	}
	println!("{x}")
}
0