結果

問題 No.1882 Areas of Triangle
ユーザー
提出日時 2024-07-02 18:15:25
言語 Rust
(1.94.0 + proconio + num + itertools)
コンパイル:
/usr/bin/rustc_custom
実行:
./target/release/main
結果
AC  
実行時間 9 ms / 2,000 ms
+ 271µs
コード長 533 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,908 ms
コンパイル使用メモリ 188,208 KB
実行使用メモリ 5,888 KB
最終ジャッジ日時 2026-08-04 04:42:56
合計ジャッジ時間 3,004 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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