/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 328.0 KiB
#2 Accepted 2ms 540.0 KiB
#3 Accepted 2ms 556.0 KiB
#4 Accepted 2ms 544.0 KiB
#5 Accepted 1ms 540.0 KiB
#6 Accepted 1ms 540.0 KiB
#7 Accepted 2ms 700.0 KiB
#8 Accepted 1ms 796.0 KiB

Code

/*
    Author    : MishkatIT
    Created   : Tuesday 10-12-2024 15:07:38
*/

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

#ifdef LOCAL
#include "algo/debug.h"
#else
#define debug(...) 42
#endif

using ll = long long;
using ld = long double;
const int mod = 1e9 + 7;
const int N = 2e5 + 10;
const int inf = 1e9;
const ll linf = 1e18;

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

    int tc;
    cin >> tc;
    while (tc--) {
        int n;
        cin>> n;
        string str;
        cin >> str;
        bool ok = true;
        string x = "SeriousOJ";
        int j = 0;
        for (int i = 0; i < n && j < x.size(); i++) {
            bool f = false;
            while (i < n) {
                if (str[i] == x[j]) {
                    j++;
                    f = true;
                    break;
                }
                i++;
            }
            if (!f) ok = false;
        }
        ok &= (j == x.size());
        cout << (ok ? "YES" : "NO") << '\n';
    }
    return 0;
}

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:12:45
Judged At
2024-12-10 09:12:45
Judged By
Score
100
Total Time
2ms
Peak Memory
796.0 KiB