/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 348.0 KiB
#2 Accepted 5ms 328.0 KiB
#3 Accepted 5ms 332.0 KiB
#4 Accepted 3ms 772.0 KiB
#5 Accepted 3ms 540.0 KiB
#6 Accepted 3ms 768.0 KiB
#7 Accepted 3ms 796.0 KiB
#8 Accepted 4ms 552.0 KiB

Code

#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define nl "\n"
int main() {
    ll t=1;
    cin>>t;
    while(t--)
    {
        ll n;
        cin>>n;
        string s;
        cin>>s;
        string x = "SeriousOJ";
        reverse(s.begin(),s.end());
        reverse(x.begin(),x.end());
        for(ll i=0;i<n;i++)
        {
            if(x.empty())
            {
                break;
            }
            if(x[0]==s[i])
            {
                if(!x.empty())
                {
                    x.erase(x.begin());
                } 
            }
        }
        if(x.empty())
        {
            cout<<"YES"<<nl;
        }
        else
        {
            cout<<"NO"<<nl;
        }
    }
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1147 SeriousOJ Challenge
Language
C++17 (G++ 13.2.0)
Submit At
2024-12-13 09:50:04
Judged At
2024-12-13 09:50:04
Judged By
Score
100
Total Time
5ms
Peak Memory
796.0 KiB