結果

問題 No.1041 直線大学
ユーザー ⁣
提出日時 2024-06-04 13:04:16
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 558 bytes
コンパイル時間 14,163 ms
コンパイル使用メモリ 379,124 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-23 10:51:55
合計ジャッジ時間 13,337 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 37
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io::Read;

fn main() {
	let mut s = String::new();
	std::io::stdin().read_to_string(&mut s).ok();
	let v: Vec<_> = s
		.lines()
		.skip(1)
		.enumerate()
		.map(|(i, s)| {
			let x: Vec<i64> = s.split(' ').flat_map(str::parse).collect();
			(i, x[0], x[1])
		})
		.collect();
	let mut a = 2;
	for (i, x, y) in v.iter() {
		for (j, p, q) in v.iter() {
			if i == j {
				continue;
			}
			let mut c = 0;
			for (_, b, d) in v.iter() {
				if (p - x) * (d - y) == (q - y) * (b - x) {
					c += 1;
				}
			}
			a = a.max(c);
		}
	}
	println!("{a}")
}
0