/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 540.0 KiB
#2 Accepted 2ms 540.0 KiB
#3 Accepted 2ms 540.0 KiB
#4 Accepted 1ms 336.0 KiB
#5 Accepted 1ms 540.0 KiB
#6 Accepted 2ms 608.0 KiB
#7 Accepted 1ms 584.0 KiB
#8 Accepted 2ms 540.0 KiB

Code

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

void solve() {
    int n; cin >> n;
    string s; cin >> s;
    string x = "SeriousOJ";
    bool fail = 0;
    for (int i = 0, j = 0; i < x.size(); i++) {
        while (j < s.size() && s[j] != x[i]) {
            j += 1;
        }
        if (j == s.size() || s[j] != x[i]) {
            fail = true;
        }
    }
    cout << (fail ? "NO" : "YES") << '\n';
} 

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int tt = 1;
    cin >> tt;
    for(int t = 1; t <= tt; t++) {
        solve();
    }
}

Information

Submit By
Type
Submission
Problem
P1147 SeriousOJ Challenge
Contest
LU IUJPC : Sylhet Division 2024 Replay Contest
Language
C++17 (G++ 13.2.0)
Submit At
2024-12-10 09:18:59
Judged At
2024-12-10 09:18:59
Judged By
Score
100
Total Time
2ms
Peak Memory
608.0 KiB