/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 556.0 KiB
#2 Accepted 2ms 328.0 KiB
#3 Accepted 3ms 488.0 KiB
#4 Accepted 1ms 540.0 KiB
#5 Accepted 2ms 492.0 KiB
#6 Accepted 2ms 540.0 KiB
#7 Accepted 2ms 780.0 KiB
#8 Accepted 2ms 768.0 KiB

Code

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


#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

template<typename T> using o_set = tree<T, null_type, std::less<T>, 
rb_tree_tag, tree_order_statistics_node_update>;


void solve() {
    int n;
    cin >> n;
    string s, t = "SeriousOJ";
    cin >> s;
    int ind = 0, m = (int) t.size();
    for (int i = 0; i < n; i++) {
        if(ind == m) break;
        if(s[i] == t[ind]) ind++;
    }
    if(ind == m) cout << "YES\n";
    else cout << "NO\n";
    
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int t = 1; 
    cin>>t;
    for(int tc = 1; tc <= t; tc++) {
        // cout<<"Case "<<tc<<":";
        solve();
    }
}

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 04:52:43
Judged At
2024-12-09 04:52:43
Judged By
Score
100
Total Time
3ms
Peak Memory
780.0 KiB