Accepted
Code
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> PII;
const ll mx = 3e5+10;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(nullptr);
cout.tie(nullptr);
int t;
cin >> t;
while(t--) {
int n;
cin >> n;
string s;
cin >> s;
string oj = "SeriousOJ";
stack<char> St;
for(int i=0; i<oj.size(); i++) {
St.push(oj[i]);
}
int Id = n - 1;
while(!St.empty() and Id >= 0) {
if(St.top() == s[Id]) {
St.pop();
}
Id --;
}
if(St.empty()) cout<<"YES"<<endl;
else cout<<"NO"<<endl;
}
}
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:23:45
- Judged At
- 2024-12-10 09:23:45
- Judged By
- Score
- 100
- Total Time
- 3ms
- Peak Memory
- 772.0 KiB