QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#190137 | #6851. Cyclically Isomorphic | yiwei | ML | 0ms | 0kb | C++14 | 960b | 2023-09-28 12:57:23 | 2023-09-28 12:57:24 |
answer
#include <cstdio>
#include <set>
#include <string>
#include <iostream>
const int N = 1e6 + 5, P = 131;
int n,m,q;
int read(){
int v = 0,x = 1;
char c = getchar();
while ((c < '0' || c > '9') && c != '-') c = getchar();
if (c == '-') c = getchar(), x = -1;
while (c >= '0' && c <= '9') v = v * 10 + (c - '0'), c = getchar();
return v * x;
}
std::set<std::string> s[N];
std::string str[N];
int main(){
// freopen("patchwork.in","r",stdin);
// freopen("patchwork.out","w",stdout);
int T; T = read();
while (T--){
n = read(), m = read();
for (int i = 1;i <= n;i++){
s[i].clear();
getline(std::cin,str[i]);
for (int j = 1;j <= m;j++){
s[i].insert(str[i]);
char c = str[i][0];
str[i].erase(0,1);
str[i] += c;
}
}
q = read();
while (q--){
int x,y; x = read(), y = read();
if (s[x].find(str[y]) != s[x].end()) puts("Yes");
else puts("No");
}
}
return 0;
}
详细
Test #1:
score: 0
Memory Limit Exceeded
input:
5 10 10000 afcadffafeeebdfedfdafecfdbeecbcadfedcffaedecbacffedeccacfcbfbbdbcefbdefefebcbeacfbaafddbabcbfaeddaaefebbddafaaaaaedcbbdaafaffcbeeebfbbeedebabfbdbaceabfcccfedbdeafccbaffdeadbefbfeadbbedeeabbaafebaceeaeedbaddfecdefaabdbcfadadaebbdeedcfeeabbbdbcefdadbeecafcabbddddbcacadbbcddeddbbeecbdadefbaa...
output:
No No No Yes Yes No No No Yes No No No No No No No No No No No No No Yes No No No No No No No No No No Yes No No No Yes No No No No No No No No Yes No Yes No No No No No Yes No No No No No No No No No Yes No No Yes No No No No No No No No No No No Yes No Yes No Yes No No No No No No No No Yes Yes Ye...