結果
| 問題 | No.1021 Children in Classrooms |
| コンテスト | |
| ユーザー |
akakimidori
|
| 提出日時 | 2020-04-10 21:31:27 |
| 言語 | Rust (1.97.1 + proconio + num + itertools + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 15 ms / 2,000 ms |
| + 858µs | |
| コード長 | 911 bytes |
| 記録 | |
| コンパイル時間 | 8,013 ms |
| コンパイル使用メモリ | 184,380 KB |
| 実行使用メモリ | 6,272 KB |
| 最終ジャッジ日時 | 2026-08-28 05:10:32 |
| 合計ジャッジ時間 | 6,274 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 |
ソースコード
use std::io::Read;
fn run() {
let mut s = String::new();
std::io::stdin().read_to_string(&mut s).unwrap();
let mut it = s.trim().split_whitespace();
let n: usize = it.next().unwrap().parse().unwrap();
let _m: usize = it.next().unwrap().parse().unwrap();
let mut q: std::collections::VecDeque<_> = (0..n).map(|_| it.next().unwrap().parse().unwrap()).collect();
let s: Vec<char> = it.next().unwrap().chars().collect();
for c in s {
if c == 'L' {
let v = q.pop_front().unwrap();
q.push_back(0);
*q.front_mut().unwrap() += v;
} else {
let v = q.pop_back().unwrap();
q.push_front(0);
*q.back_mut().unwrap() += v;
}
}
let mut ans = String::new();
for a in q {
ans.push_str(&format!("{} ", a));
}
ans.pop();
println!("{}", ans);
}
fn main() {
run();
}
akakimidori