Submission #16079560
Source Code Expand
use proconio::input;
use proconio::marker::Chars;
fn main() {
input! {
s: Chars
};
let n = s.len();
let mut t = vec![];
let mut i = 0;
while i < n {
if s[i] == 'B' && i + 1 < n && s[i + 1] == 'C' {
t.push('D');
i += 2;
} else {
t.push(s[i]);
i += 1;
};
}
let mut c = 0_i64;
let mut c_a = 0_i64;
for &t_i in t.iter() {
match t_i {
'A' => c_a += 1,
'D' => c += c_a,
_ => c_a = 0,
}
}
println!("{}", c);
}
Submission Info
| Submission Time | |
|---|---|
| Task | B - ABC |
| User | bouzuya |
| Language | Rust (1.42.0) |
| Score | 600 |
| Code Size | 584 Byte |
| Status | AC |
| Exec Time | 16 ms |
| Memory | 3924 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 600 / 600 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 0_000.txt, 0_001.txt, 0_002.txt |
| All | 0_000.txt, 0_001.txt, 0_002.txt, 1_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt, 1_010.txt, 1_011.txt, 1_012.txt, 1_013.txt, 1_014.txt, 1_015.txt, 1_016.txt, 1_017.txt, 1_018.txt, 1_019.txt, 1_020.txt, 1_021.txt, 1_022.txt, 1_023.txt, 1_024.txt, 1_025.txt, 1_026.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 0_000.txt | AC | 6 ms | 2012 KiB |
| 0_001.txt | AC | 2 ms | 2072 KiB |
| 0_002.txt | AC | 2 ms | 2020 KiB |
| 1_003.txt | AC | 4 ms | 1928 KiB |
| 1_004.txt | AC | 2 ms | 1984 KiB |
| 1_005.txt | AC | 2 ms | 2040 KiB |
| 1_006.txt | AC | 10 ms | 3636 KiB |
| 1_007.txt | AC | 13 ms | 3596 KiB |
| 1_008.txt | AC | 9 ms | 3692 KiB |
| 1_009.txt | AC | 9 ms | 3668 KiB |
| 1_010.txt | AC | 16 ms | 3688 KiB |
| 1_011.txt | AC | 9 ms | 3924 KiB |
| 1_012.txt | AC | 8 ms | 3900 KiB |
| 1_013.txt | AC | 6 ms | 3892 KiB |
| 1_014.txt | AC | 5 ms | 3748 KiB |
| 1_015.txt | AC | 3 ms | 3616 KiB |
| 1_016.txt | AC | 5 ms | 3652 KiB |
| 1_017.txt | AC | 5 ms | 3496 KiB |
| 1_018.txt | AC | 7 ms | 3624 KiB |
| 1_019.txt | AC | 6 ms | 3632 KiB |
| 1_020.txt | AC | 5 ms | 3516 KiB |
| 1_021.txt | AC | 6 ms | 3580 KiB |
| 1_022.txt | AC | 9 ms | 3600 KiB |
| 1_023.txt | AC | 10 ms | 3688 KiB |
| 1_024.txt | AC | 5 ms | 3688 KiB |
| 1_025.txt | AC | 11 ms | 3616 KiB |
| 1_026.txt | AC | 7 ms | 3636 KiB |