結果
| 問題 | No.3420 Letter Loading |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-01-11 13:44:25 |
| 言語 | Rust (1.92.0 + proconio + num) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| コード長 | 1,006 bytes |
| 記録 | |
| コンパイル時間 | 23,237 ms |
| コンパイル使用メモリ | 414,908 KB |
| 実行使用メモリ | 7,852 KB |
| 最終ジャッジ日時 | 2026-01-11 14:03:50 |
| 合計ジャッジ時間 | 24,244 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 12 |
ソースコード
use proconio::{fastout, input, marker::Bytes};
#[fastout]
fn main() {
input! {
_n: usize,
w: usize,
h: u8,
s: Bytes,
}
println!("{}", output(solve(w, h, s)));
}
fn solve(w: usize, h: u8, s: Vec<u8>) -> Vec<Vec<u8>> {
let mut count_of = vec![0; w];
let mut r = 0;
let mut c = 0;
for &s in &s {
match s {
b'o' => r += 1,
b'l' => {
count_of[c as usize] = r;
r = 0;
c += 1;
}
_ => unreachable!(),
}
}
if c < count_of.len() {
count_of[c as usize] = r;
}
(0..h)
.map(|r| {
count_of
.iter()
.map(|&c| if c >= (h - r) { b'o' } else { b'x' })
.collect()
})
.collect()
}
fn output(ans: Vec<Vec<u8>>) -> String {
ans.into_iter()
.map(|x| String::from_utf8(x).unwrap())
.collect::<Vec<_>>()
.join("\n")
}