/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 3ms 540.0 KiB
#2 Accepted 2ms 540.0 KiB
#3 Accepted 2ms 432.0 KiB
#4 Accepted 3ms 840.0 KiB
#5 Accepted 91ms 98.43 MiB
#6 Accepted 3ms 1.492 MiB
#7 Accepted 2ms 328.0 KiB

Code

#include <bits/stdc++.h>
using namespace std;

bool validSub(string s1, string s2, int m, int n)
{
    if (m == 0)
        return true;
    if (n == 0)
        return false;
    if (s1[m - 1] == s2[n - 1])
        return validSub(s1, s2, m - 1, n - 1);
    return validSub(s1, s2, m, n - 1);
}
int main()
{
    int t;
    cin >> t;
    while (t--)
    {
        string s1, s2;
        cin >> s2 >> s1;
        int m = s1.size();
        int n = s2.size();

        if (validSub(s1, s2, m, n))
            cout << "YES" << endl;
        else
            cout << "NO" << endl;
    }
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1020 Favourite footballer
Contest
Brain booster - 1
Language
C++20 (G++ 13.2.0)
Submit At
2023-12-31 14:54:54
Judged At
2024-11-11 03:46:06
Judged By
Score
100
Total Time
91ms
Peak Memory
98.43 MiB