/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 768.0 KiB
#2 Accepted 5ms 540.0 KiB
#3 Accepted 5ms 332.0 KiB
#4 Accepted 3ms 768.0 KiB
#5 Accepted 3ms 420.0 KiB
#6 Accepted 3ms 540.0 KiB
#7 Accepted 4ms 572.0 KiB
#8 Accepted 3ms 540.0 KiB

Code

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define bug(a) cout << #a << " : " << a << '\n';

void solve(int cs){
   string s = "SeriousOJ";
   int n;cin >> n;
   int ind = 0;bool ok = false;
   for (int i = 0; i < n; ++i)
   {
       char c;cin >> c;
       if(c == s[ind]) ind++;
       if(ind == s.size()) ok = true;
   }
   if(ok)cout << "YES\n";
   else cout << "NO" << endl;


}

int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);


    int t; cin>>t;
    int cs = 0;
    while(t--){
        solve(++cs);
    }
    
    return 0;
}

Information

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