Submission #74663554
Source Code Expand
#include <bits/stdc++.h>
using ull = unsigned long long int;
using ll = long long int;
using lll = __int128;
using namespace std;
const int mod = 1e9 + 7;
int d[4][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
inline string sread() {
string s;
char ch = getchar();
// 跳过空白字符
while (ch == ' ' || ch == '\n' || ch == '\r') ch = getchar();
// 读取非空白字符
while (ch != ' ' && ch != '\n' && ch != '\r' && ch != EOF) {
s += ch;
ch = getchar();
}
return s;
}
ll read(){
ll k = 0,f = 1;
char c = getchar();
while(c < '0' || c > '9')
{
if(c == '-')f = -1;
c = getchar();
}
while(c >= '0' && c <= '9')k = k * 10 + c - '0',c = getchar();
return k * f; // 别忘记标记的负数要乘进去
}
// 调用时用 n = in();
void print(ll x){
if(x < 0)putchar('-'),x = -x;
if(x < 10)putchar(x + '0');
else print(x / 10),putchar(x % 10 + '0');
}
// 直接调用 out(n) 就行了
ll ksm(ll base, ll e){
ll res = 1;
while(e){
if(e & 1){
res = res * base % mod;
}
base = base * base % mod;
e >>= 1;
}
return res;
}//ksm板子
vector<vector<ll>> matrix_mul (vector<vector<ll>>& a, vector<vector<ll>>& b) {
int l1 = a.size(), l2 = b[0].size();
vector<vector<ll>>res(l1, vector<ll>(l2, 0));
for(int i = 0; i < l1; i++){
for(int k = 0; k < a[0].size(); k++){
if(a[i][k]){
for(int j = 0; j < l2; j++){
res[i][j] = (res[i][j] + a[i][k] * b[k][j]);
}
}
}
}
return res;
}// 矩阵a * 矩阵b(矩阵乘法)
void Solve(){
int n = read();
vector<vector<int>>cnt(n, vector<int>(2));
for(int i = 0; i < n; i++){
cnt[i][0] = read();
cnt[i][1] = read();
}
int m = read();
int vis[11][11][26] = {0};
vector<string>str(m);
for(int i = 0; i < m; i++){
string s;
cin >> s;
str[i] = s;
int len = s.size();
for(int j = 1; j <= len; j++){
vis[len][j][s[j - 1] - 'a'] = 1;
}
}
for(int i = 0; i < m; i++){
int isok = 1;
string s = str[i];
int len = s.size();
if(len != n){
cout << "No" << '\n';
continue;
}
for(int j = 0; j < n; j++){
if(vis[cnt[j][0]][cnt[j][1]][s[j] - 'a'] == 0){
isok = 0;
break;
}
}
if(isok){
cout << "Yes" << '\n';
}
else{
cout << "No" << '\n';
}
}
}
signed main(){
int T = 1;
while(T--){
Solve();
}
return 0;
}
Submission Info
Submission Time
2026-04-04 21:25:57+0900
Task
C - Fishbones
User
wmxw
Language
C++23 (GCC 15.2.0)
Score
300
Code Size
2827 Byte
Status
AC
Exec Time
52 ms
Memory
9604 KiB
Compile Error
./Main.cpp: In function 'std::vector<std::vector<long long int> > matrix_mul(std::vector<std::vector<long long int> >&, std::vector<std::vector<long long int> >&)':
./Main.cpp:53:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
53 | for(int k = 0; k < a[0].size(); k++){
| ~~^~~~~~~~~~~~~
Judge Result
Set Name
Sample
All
Score / Max Score
0 / 0
300 / 300
Status
Set Name
Test Cases
Sample
00-sample-01.txt, 00-sample-02.txt
All
00-sample-01.txt, 00-sample-02.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt, 01-15.txt, 01-16.txt, 01-17.txt, 01-18.txt, 01-19.txt, 01-20.txt, 01-21.txt, 01-22.txt, 01-23.txt
Case Name
Status
Exec Time
Memory
00-sample-01.txt
AC
1 ms
3652 KiB
00-sample-02.txt
AC
1 ms
3608 KiB
01-01.txt
AC
7 ms
4196 KiB
01-02.txt
AC
23 ms
6784 KiB
01-03.txt
AC
39 ms
9340 KiB
01-04.txt
AC
24 ms
6888 KiB
01-05.txt
AC
30 ms
7944 KiB
01-06.txt
AC
27 ms
7268 KiB
01-07.txt
AC
45 ms
9600 KiB
01-08.txt
AC
49 ms
9544 KiB
01-09.txt
AC
7 ms
4172 KiB
01-10.txt
AC
23 ms
6760 KiB
01-11.txt
AC
7 ms
4052 KiB
01-12.txt
AC
37 ms
8808 KiB
01-13.txt
AC
27 ms
7192 KiB
01-14.txt
AC
22 ms
6504 KiB
01-15.txt
AC
47 ms
9496 KiB
01-16.txt
AC
52 ms
9600 KiB
01-17.txt
AC
49 ms
9604 KiB
01-18.txt
AC
49 ms
9572 KiB
01-19.txt
AC
49 ms
9604 KiB
01-20.txt
AC
49 ms
9496 KiB
01-21.txt
AC
49 ms
9576 KiB
01-22.txt
AC
50 ms
9604 KiB
01-23.txt
AC
49 ms
9604 KiB