QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#335961 | #8104. Keyboard | ucup-team1209# | WA | 0ms | 3632kb | C++20 | 1.3kb | 2024-02-24 10:28:51 | 2024-02-24 10:28:52 |
Judging History
answer
#include<bits/stdc++.h>
#define cs const
#define pb push_back
using namespace std;
cs int N = 1e6 + 5;
string S, T;
int n;
int nxt[N][52];
int id(char c) {
return ('a' <= c && c <= 'z') ? c - 'a' : c - 'A' + 26;
}
int main() {
#ifdef zqj
freopen("1.in","r",stdin);
#endif
ios :: sync_with_stdio(0), cin.tie(0);
cin >> S;
cin >> n;
int m = S.length();
for(int i = 0; i < m; i++)
if(i & 1 ^ 1){
if('a' <= S[i] && S[i] <= 'z') S[i] = S[i] - 'a' + 'A';
else S[i] = S[i] - 'A' + 'a';
}
vector <int> c(52, m);
for(int i = m - 1; i >= 0; i--){
int t = id(S[i]);
c[t] = i;
for(int j = 0; j < 52; j++) nxt[i][j] = c[j];
}
for(int i = 1; i <= n; i++) {
cin >> T;
int k = T.length();
for(int i = 0; i < k; i++)
if(i & 1 ^ 1){
if('a' <= T[i] && T[i] <= 'z') T[i] = T[i] - 'a' + 'A';
else T[i] = T[i] - 'A' + 'a';
}
int cur = 0;
for(int i = 0;i < k; i++) {
// cout << T[i] <<' ' << id(T[i]) << endl;
cur = nxt[cur][id(T[i])];
if(cur >= m) break;
}
if(cur < m) {
cout << "YES\n";
}
else {
cout << "NO\n";
}
}
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3576kb
input:
PTaak 4 PA tak ptak nie
output:
YES YES NO NO
result:
ok 4 token(s): yes count is 2, no count is 2
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3632kb
input:
X 5 XX Xx X x a
output:
NO YES YES NO NO
result:
wrong answer expected NO, found YES [2nd token]