QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#865590 | #9925. LR String | x998244353x | WA | 90ms | 27760kb | C++20 | 938b | 2025-01-21 20:11:04 | 2025-01-21 20:11:04 |
Judging History
answer
#include <iostream>
#include <cstdio>
#define N 500005
using namespace std;
int lens[N],cnt[N],pre[N],nxt[N],c[N],T,n,lenstr,cnt_;
string s[N],str;
signed main ()
{
cin>>T;
while (T--)
{
cin>>str;
lenstr=str.size();
cin>>n;
for (int i=1; i<=n; i++)
{
cin>>s[i];
lens[i]=s[i].size();
}
for (int i=1; i<=n; i++)
{
pre[i]=i-1;
nxt[i]=i+1;
cnt[i]=1;
}
s[0]='#';
nxt[0]=1;
nxt[n+1]=n+1;
for (int i=1; i<=lenstr; i++)
{
cnt_=0;
for (int j=0; j<=n; j=nxt[j]) c[++cnt_]=j;
for (int j=1; j<=cnt_; j++)
{
if (str[i-1]==s[c[j]][cnt[c[j]]-1])
if (++cnt[c[j]]>lens[c[j]])
{
nxt[pre[c[j]]]=nxt[c[j]];
pre[nxt[c[j]]]=pre[c[j]];
}
}
}
// for (int i=1; i<=n; i++)
// cout<<cnt[i]<<" "<<lens[i]<<endl;
for (int i=1; i<=n; i++)
if (cnt[i]>lens[i]) printf("YES\n");
else printf("NO\n");
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 27168kb
input:
2 RRLLRRLL 4 LLLLL LLR LRLR R RLLLLLL 3 LLLLL RL RRL
output:
NO YES NO YES YES YES NO
result:
ok 7 lines
Test #2:
score: -100
Wrong Answer
time: 90ms
memory: 27760kb
input:
100000 RRLLR 4 R R R R LRLLL 6 R L L L L R RLLRR 1 L LRLLL 3 R L L RLRRL 2 LRRRR RRRL LRLRR 2 L R RRLRL 4 RLRLR RLLL LR RLL RLRLL 8 R R R L L L R L RLLRR 7 R LL RL R L L L LLRLR 2 L R RRRRL 1 RLLLR RRLLL 2 L L RLLRL 1 RLLRL LRLLL 5 RLRLL RLLLR RRRRL LLRRR RLLRR LRLLL 3 RRLL R RL LLRRL 3 L R LLLRR RR...
output:
YES YES YES YES YES YES YES YES YES YES YES YES YES YES NO YES YES YES NO NO YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES NO YES YES YES NO NO NO NO NO NO YES YES YES YES NO NO YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES NO YES YES YES N...
result:
wrong answer 5th lines differ - expected: 'NO', found: 'YES'