Accepted
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