結果

問題 No.1882 Areas of Triangle
ユーザー
提出日時 2024-07-02 18:15:25
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 17 ms / 2,000 ms
コード長 533 bytes
コンパイル時間 13,122 ms
コンパイル使用メモリ 377,788 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-02 18:15:39
合計ジャッジ時間 13,503 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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();
	let mut x = 0;
	for &i in &a {
		x += match a.binary_search_by(|a| match (i * a).cmp(&(2 * n[1])) {
			Ordering::Equal => Ordering::Greater,
			o => o,
		}) {
			Ok(j) | Err(j) => n[0] - j,
		};
	}
	println!("{x}")
}
0