Please sign in first.
Submission #40391198
Source Code Expand
use proconio::{input, marker::Chars};
fn dfs(s: &[char], length: usize, t: &mut Vec<char>, count: &mut usize) {
if t.len() == length {
let mut ok = false;
for i in 0..s.len() {
if i + t.len() > s.len() {
continue;
}
let mut m = true;
for (j, p) in t.iter().copied().enumerate() {
if p != '.' && p != s[i + j] {
m = false;
}
}
ok |= m;
}
if ok {
*count += 1;
}
return;
}
for i in 0_usize..26 + 1 {
let c = if i < 26 {
(i as u8 + b'a') as char
} else {
'.'
};
t.push(c);
dfs(s, length, t, count);
t.pop();
}
}
fn main() {
input! {
s: Chars
}
let mut count = 0_usize;
for length in 1..=3 {
let mut c = 0_usize;
dfs(&s, length, &mut vec![], &mut c);
count += c;
}
let ans = count;
println!("{}", ans);
}
Submission Info
| Submission Time | |
|---|---|
| Task | D - String Match |
| User | bouzuya |
| Language | Rust (1.42.0) |
| Score | 7 |
| Code Size | 1052 Byte |
| Status | AC |
| Exec Time | 23 ms |
| Memory | 2188 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 7 / 7 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | s1.txt, s2.txt, s3.txt |
| All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt, 27.txt, 28.txt, 29.txt, 30.txt, 31.txt, 32.txt, 33.txt, s1.txt, s2.txt, s3.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 01.txt | AC | 7 ms | 2112 KiB |
| 02.txt | AC | 2 ms | 2080 KiB |
| 03.txt | AC | 2 ms | 2128 KiB |
| 04.txt | AC | 2 ms | 2040 KiB |
| 05.txt | AC | 2 ms | 2096 KiB |
| 06.txt | AC | 2 ms | 2052 KiB |
| 07.txt | AC | 3 ms | 2096 KiB |
| 08.txt | AC | 2 ms | 1972 KiB |
| 09.txt | AC | 2 ms | 2128 KiB |
| 10.txt | AC | 5 ms | 2052 KiB |
| 11.txt | AC | 2 ms | 2156 KiB |
| 12.txt | AC | 2 ms | 2032 KiB |
| 13.txt | AC | 16 ms | 2028 KiB |
| 14.txt | AC | 17 ms | 2076 KiB |
| 15.txt | AC | 15 ms | 2072 KiB |
| 16.txt | AC | 20 ms | 2072 KiB |
| 17.txt | AC | 16 ms | 2052 KiB |
| 18.txt | AC | 15 ms | 2132 KiB |
| 19.txt | AC | 17 ms | 2080 KiB |
| 20.txt | AC | 16 ms | 1964 KiB |
| 21.txt | AC | 17 ms | 2104 KiB |
| 22.txt | AC | 17 ms | 1984 KiB |
| 23.txt | AC | 18 ms | 2104 KiB |
| 24.txt | AC | 17 ms | 2072 KiB |
| 25.txt | AC | 16 ms | 2032 KiB |
| 26.txt | AC | 15 ms | 2072 KiB |
| 27.txt | AC | 16 ms | 2056 KiB |
| 28.txt | AC | 18 ms | 2052 KiB |
| 29.txt | AC | 18 ms | 2188 KiB |
| 30.txt | AC | 21 ms | 2036 KiB |
| 31.txt | AC | 23 ms | 2080 KiB |
| 32.txt | AC | 17 ms | 2184 KiB |
| 33.txt | AC | 19 ms | 2052 KiB |
| s1.txt | AC | 2 ms | 2064 KiB |
| s2.txt | AC | 2 ms | 1984 KiB |
| s3.txt | AC | 2 ms | 2092 KiB |