QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#864701#9925. LR StringjmnbWA 26ms3712kbC++20845b2025-01-20 21:56:382025-01-20 21:56:39

Judging History

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

  • [2025-01-20 21:56:39]
  • 评测
  • 测评结果:WA
  • 用时:26ms
  • 内存:3712kb
  • [2025-01-20 21:56:38]
  • 提交

answer

#include <iostream>
#include <string>
#include <vector>

using namespace std;

bool canForm(const string& s, const string& t) {
    int s_len = s.length();
    int t_len = t.length();

    int s_pos = 0, t_pos = 0;
    while (s_pos < s_len && t_pos < t_len) {
        if (s[s_pos] == t[t_pos]) {
            t_pos++;
        }
        s_pos++;
    }
    return t_pos == t_len;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int T;
    cin >> T;

    while (T--) {
        string s;
        cin >> s;

        int q;
        cin >> q;

        while (q--) {
            string t;
            cin >> t;
            if (canForm(s, t)) {
                cout << "YES\n";
            } else {
                cout << "NO\n";
            }
        }
    }

    return 0;
}

详细

Test #1:

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

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: 26ms
memory: 3584kb

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'