/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 540.0 KiB
#2 Accepted 5ms 580.0 KiB
#3 Accepted 6ms 332.0 KiB
#4 Accepted 3ms 540.0 KiB
#5 Accepted 4ms 340.0 KiB
#6 Accepted 3ms 772.0 KiB
#7 Accepted 4ms 648.0 KiB
#8 Accepted 3ms 588.0 KiB

Code

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

bool isSubsequence(const string &s, const string &target)
{
    int targetIndex = 0;
    for (char c : s)
    {
        if (c == target[targetIndex])
        {
            targetIndex++;
        }
        if (targetIndex == target.size())
        {
            return true;
        }
    }
    return false;
}

int main()
{
    int T;
    cin >> T;
    string target = "SeriousOJ";

    while (T--)
    {
        int N;
        cin >> N;
        string S;
        cin >> S;

        if (isSubsequence(S, target))
        {
            cout << "YES" << endl;
        }
        else
        {
            cout << "NO" << endl;
        }
    }
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1147 SeriousOJ Challenge
Contest
LU IUJPC : Sylhet Division 2024 Replay Contest
Language
C++17 (G++ 13.2.0)
Submit At
2024-12-10 10:13:04
Judged At
2024-12-10 10:13:04
Judged By
Score
100
Total Time
6ms
Peak Memory
772.0 KiB