/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 540.0 KiB
#2 Accepted 3ms 540.0 KiB
#3 Accepted 3ms 540.0 KiB
#4 Accepted 2ms 540.0 KiB
#5 Accepted 2ms 452.0 KiB
#6 Accepted 1ms 796.0 KiB
#7 Accepted 3ms 540.0 KiB
#8 Accepted 2ms 844.0 KiB

Code

#include <bits/stdc++.h>
using namespace std ;
#define int long long
#define opt() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int N = 2e5+10 ;
const int mod= 1e9+7 ;
#define pb push_back
#define mp make_pair

int32_t main()
{
    opt();
    int tt=1;
    cin>>tt;
    for(int tc=1;tc<=tt;tc++)
    {
        int n;
        cin>>n;
     string s="SeriousOJ";
     string p;
     cin>>p;
     int j=0;
     string ans;
     for(int i=0;i<s.size() && j<p.size();)
     {
         if(s[i]==p[j] && j<p.size() && i<s.size())
         {
             ans.pb(s[i]);
             i++;
             j++;
             
         }
         else j++;
     }
if(ans==s)cout<<"YES"<<endl;
else cout<<"NO"<<endl;
    }
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1147 SeriousOJ Challenge
Contest
LU IUJPC : Sylhet Division 2024
Language
C++11 (G++ 13.2.0)
Submit At
2024-12-09 05:00:41
Judged At
2024-12-09 05:00:41
Judged By
Score
100
Total Time
3ms
Peak Memory
844.0 KiB