Accepted
Code
#include<bits/stdc++.h>
using namespace std;
using i64 = long long;
void solve() {
int n; cin >> n;
string s; cin >> s;
string x = "SeriousOJ";
bool fail = 0;
for (int i = 0, j = 0; i < x.size(); i++) {
while (j < s.size() && s[j] != x[i]) {
j += 1;
}
if (j == s.size() || s[j] != x[i]) {
fail = true;
}
}
cout << (fail ? "NO" : "YES") << '\n';
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int tt = 1;
cin >> tt;
for(int t = 1; t <= tt; t++) {
solve();
}
}
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 09:18:59
- Judged At
- 2024-12-10 09:18:59
- Judged By
- Score
- 100
- Total Time
- 2ms
- Peak Memory
- 608.0 KiB