/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 540.0 KiB
#2 Accepted 2ms 516.0 KiB
#3 Accepted 2ms 564.0 KiB
#4 Accepted 2ms 772.0 KiB
#5 Accepted 2ms 516.0 KiB
#6 Accepted 2ms 540.0 KiB
#7 Accepted 2ms 540.0 KiB
#8 Accepted 2ms 540.0 KiB

Code

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

typedef int64_t ll;

#ifdef LOCAL
#include "debug.hpp"
#else
#define debug(...) 42
#endif

const string t = "SeriousOJ";

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll T;
    cin >> T;
    while (T--) {
        ll n;
        cin >> n;
        string s;
        cin >> s;
        ll i = 0, j = 0;
        while (i < n && j < t.length()) {
            if (s[i] == t[j]) {
                i++, j++;
            } else {
                i++;
            }
        }
        cout << (j == t.length() ? "YES\n" : "NO\n");
    }
}

Information

Submit By
Type
Submission
Problem
P1147 SeriousOJ Challenge
Language
C++17 (G++ 13.2.0)
Submit At
2024-12-12 11:57:16
Judged At
2024-12-12 11:57:16
Judged By
Score
100
Total Time
2ms
Peak Memory
772.0 KiB