Accepted
Code
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define nl "\n"
#define yes << "YES\n"
#define no << "NO\n"
#define sp " "
void solve()
{
int n;
cin >> n;
string s = "SeriousOJ", p;
cin >> p;
int a = 0;
for (int i = 0; i < s.size(); i++)
{
int val = 0;
for (int j = a; j < n; j++)
{
if (s[i] == p[j])
{
val = 1;
a = j + 1;
break;
}
}
if (val == 0)
{
cout no;
return;
}
}
cout yes;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll t;
cin >> t;
for (ll i = 0; i < t; i++)
solve();
return 0;
}
Information
- Submit By
- Type
- Submission
- Problem
- P1147 SeriousOJ Challenge
- Contest
- LU IUJPC : Sylhet Division 2024
- Language
- C++17 (G++ 13.2.0)
- Submit At
- 2024-12-09 05:10:33
- Judged At
- 2024-12-09 05:10:33
- Judged By
- Score
- 100
- Total Time
- 3ms
- Peak Memory
- 796.0 KiB