結果
| 問題 | No.3395 Range Flipping Game |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-12-07 01:55:33 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
AC
|
| 実行時間 | 18 ms / 2,000 ms |
| コード長 | 1,087 bytes |
| 記録 | |
| コンパイル時間 | 12,902 ms |
| コンパイル使用メモリ | 401,940 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2025-12-07 01:55:52 |
| 合計ジャッジ時間 | 16,015 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 30 |
ソースコード
use proconio::{fastout, input, marker::Bytes};
#[fastout]
fn main() {
input! {
t: usize,
}
for _ in 0..t {
input! {
n: usize,
mut s: Bytes,
}
if s[0] == b'A' {
s[0] = b'B';
let mut i = 1;
if n > 1 {
i = 2;
if s[1] == b'B' {
while i < n && s[i] == b'A' {
i += 1;
}
}
s[1] = b'B';
}
for i in i..n {
if s[i] != b'B' {
break;
} else {
s[i] = b'A';
}
}
} else {
if n > 1 && s[1] == b'A' {
s[1] = b'B';
for i in 2..n {
if s[i] != b'B' {
break;
} else {
s[i] = b'A';
}
}
}
}
println!("{}", String::from_utf8(s).unwrap());
}
}