/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 540.0 KiB
#2 Accepted 2ms 540.0 KiB
#3 Accepted 3ms 568.0 KiB
#4 Accepted 1ms 328.0 KiB
#5 Accepted 2ms 492.0 KiB
#6 Accepted 1ms 632.0 KiB
#7 Accepted 2ms 744.0 KiB
#8 Accepted 2ms 796.0 KiB

Code

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define nl "\n"
#define yes << "YES\n"
#define no << "NO\n"
#define sp " "
void solve()
{
    int n;
    cin >> n;
    string s = "SeriousOJ", p;
    cin >> p;
    int a = 0;
    for (int i = 0; i < s.size(); i++)
    {
        int val = 0;
        for (int j = a; j < n; j++)
        {
            if (s[i] == p[j])
            {
                   val = 1;
                a = j + 1;
                break;
             
            }
        }
        if (val == 0)
        {
            cout no;
            return;
        }
    }
    cout yes;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t;
    cin >> t;
    for (ll i = 0; i < t; i++)
        solve();
    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:10:33
Judged At
2024-12-09 05:10:33
Judged By
Score
100
Total Time
3ms
Peak Memory
796.0 KiB