/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 540.0 KiB
#2 Accepted 3ms 540.0 KiB
#3 Accepted 2ms 540.0 KiB
#4 Accepted 2ms 540.0 KiB
#5 Accepted 2ms 540.0 KiB
#6 Accepted 2ms 544.0 KiB
#7 Accepted 2ms 816.0 KiB
#8 Accepted 2ms 692.0 KiB

Code

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

#define RASHED ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"
#define int long long int

#define show(x) cout << #x << " = " << x << endl
#define inf (int)1e18
#define maxn 100010

#define F first
#define S second
string serious = "SeriousOJ";
void solve(int tc) {
    int n;cin>>n;
    string s;cin>>s;
    bool res = true;
    int kk = 0;
    for(int i=0;i<serious.size();i++){
        bool gotit = false;
        for(int j=kk;j<s.size();j++){
            if(serious[i] == s[j]){
                kk = j+1;
                gotit = true;
                break;
            }
        }
        if(gotit == false){
            res = false;
            break;
        }
    }
    cout<<(res?"YES":"NO")<<endl;
}
signed main() {
    RASHED
    int TC = 1;
    cin>>TC;
    for(int i=1; i<=TC; i++)solve(i);
    return 0;
}
/**
CASES:

*/

Information

Submit By
Type
Submission
Problem
P1147 SeriousOJ Challenge
Language
C++17 (G++ 13.2.0)
Submit At
2024-12-10 18:41:23
Judged At
2024-12-10 18:41:23
Judged By
Score
100
Total Time
3ms
Peak Memory
816.0 KiB