update
This commit is contained in:
parent
b428e1c679
commit
c533973e8b
@ -10,22 +10,21 @@ static constexpr auto range {std::ranges::views::iota};
|
||||
static std::bitset<MAX_LEN> dp[MAX_LEN];
|
||||
|
||||
int main(){
|
||||
const auto get_p = [](const size_t n)noexcept->const char&{return p[n-1];};
|
||||
const auto get_s = [](const size_t n)noexcept->const char&{return s[n-1];};
|
||||
|
||||
std::cin>>s>>p;
|
||||
|
||||
dp[0][0] = true;
|
||||
|
||||
for(const size_t j:range((size_t)1,p.size())){
|
||||
const auto get_p = [](const size_t n)->char{return p[n-1];};
|
||||
for(const size_t j:range((size_t)1,p.size()+1)){
|
||||
if(get_p(j)=='*'){
|
||||
dp[0][j] = dp[0][j-1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(const size_t i:range((size_t)1,s.size()+1)){
|
||||
for(const size_t j:range((size_t)1,p.size()+1)){
|
||||
const auto get_p = [](const size_t n)->char{return p[n-1];};
|
||||
const auto get_s = [](const size_t n)->char{return s[n-1];};
|
||||
|
||||
if(get_p(j) == get_s(j) || get_p(j)=='?'){
|
||||
dp[i][j] = dp[i-1][j-1];
|
||||
}else if(get_p(j)=='*'){
|
||||
@ -33,6 +32,5 @@ int main(){
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::cout<<(dp[s.size()][p.size()]==true?"yes":"no")<<'\n';
|
||||
}
|
Loading…
Reference in New Issue
Block a user