結果

問題 No.1130 Grid Numbers
ユーザー ixTL255
提出日時 2023-01-03 01:45:18
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 515 bytes
コンパイル時間 11,685 ms
コンパイル使用メモリ 380,192 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-27 01:35:16
合計ジャッジ時間 12,772 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io::Read;

fn main() {
	let mut s = String::new();
	std::io::stdin().read_to_string(&mut s).ok();
	let mut s = s.trim().split_whitespace();
	let h: usize = s.next().unwrap().parse().unwrap();
	let w: usize = s.next().unwrap().parse().unwrap();
	let mut a: Vec<usize> = s.map(|e| e.parse().unwrap()).collect();
	a.sort();
	
	let mut ans = String::new();
	
	for i in 0..h * w {
		ans += &a[i].to_string();
		if (i + 1) % w != 0 { ans += " "; }
		if (i + 1) % w == 0 { ans += "\n"; } 
	}
	print!("{}", ans);
}
0