QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#841733#9925. LR StringKXDdesuWA 24ms3848kbC++23732b2025-01-03 23:41:182025-01-03 23:41:19

Judging History

你现在查看的是最新测评结果

  • [2025-01-03 23:41:19]
  • 评测
  • 测评结果:WA
  • 用时:24ms
  • 内存:3848kb
  • [2025-01-03 23:41:18]
  • 提交

answer

#include<bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define fi first
#define se second
#define lowbit(x) ((x) & (-x))
using i64 = long long;
using pii = std::pair<int, int>;
void solve()
{
	std::string s;
	std::cin >> s;
	const int n = s.size();
	int q;
	std::cin >> q;
	while (q --) {
		std::string t;
		std::cin >> t;
		int j = 0;
		const int m = t.size();
		for (int i = 0; i < n; ++ i) {
			if (s[i] == t[j]) {
				j ++;
			}
		}
		if (j == m) {
			std::cout << "YES\n";
		}
		else {
			std::cout << "NO\n";
		}
	}
}
int main()
{
	std::cin.tie(nullptr);
	std::cout.tie(nullptr);
	std::ios::sync_with_stdio(false);
	int T = 1;
	std::cin >> T;
	while (T --) solve();
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3552kb

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: 24ms
memory: 3848kb

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'