/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 4ms 6.277 MiB
#2 Accepted 5ms 6.043 MiB
#3 Accepted 4ms 6.527 MiB
#4 Accepted 4ms 5.277 MiB
#5 Accepted 4ms 5.277 MiB
#6 Accepted 4ms 6.402 MiB
#7 Accepted 4ms 5.504 MiB
#8 Accepted 4ms 5.527 MiB

Code

#include<bits/stdc++.h>
#define pll              pair<ll,ll>
#define pii              pair<int,int>
#define scn(a)           scanf("%d", &a)
#define scn2(a, b)       scanf("%d%d", &a, &b)
#define scn3(a, b, c)    scanf("%d%d%d", &a, &b, &c)
#define pairl            pair<ll , ll >
#define scnl(a)          scanf("%lld", &a)
#define scnl2(a, b)      scanf("%lld%lld", &a, &b)
#define scnl3(a, b, c)   scanf("%lld%lld%lld", &a, &b, &c)
#define scns(s)          scanf("%s",s)
#define prts(s)          printf("%s\n",s)
#define prt(a)           printf("%d\n", a)
#define prtl(a)          printf("%lld\n", a)
#define prs(a)           printf("%d ", a)
#define prt2(a, b)       printf("%d %d\n", a, b)
#define prt3(a, b, c)    printf("%d %d %d\n", a, b, c)
#define prsl(a)          printf("%lld ", a)
#define prtl2(a, b)      printf("%lld %lld\n", a, b)
#define prtl3(a, b, c)   printf("%lld %lld %lld\n", a, b, c)
#define ptcs(a)          printf("Case %d: ", a)
#define pf               printf
#define S                second
#define F                first
#define sc               scanf
#define vi               vector<int >
#define vil              vector<ll >
#define pb               push_back
#define mem(a, b)        memset((a), (b), sizeof(a))
#define lg2(n)           (31-__builtin_clz(n))
#define inf              9999999999
#define PI               acos(-1.0)
#define ll               long long
#define ull              unsigned long long
#define MIN              INT_MIN
#define MAX              INT_MAX
#define fast             ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
const int N = 3e5 + 5;
const int mod = 998244353;
typedef tree<
pll,
null_type,
less<pll>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
ll gcd(ll a, ll b){if(b==0) {return a;}return gcd(b, a % b);}
ll BigMod(ll B,ll P,ll M){     ll R=1; while(P>0)      {if(P%2==1){R=(R*B)%M;}P/=2;B=(B*B)%M;} return R;}
ll x,y,n,m,t,k,k1,mx,mx1,x1,x2,x3,x4,x5,an,q,a,l,r,b,z,h;
bool vis[1001][1001],vis1[1001][1001],vis2[N];
ll ar[N],br[N],cr[N],dr[N],dp[55][300];
vector<ll>v2,v;
vector<ll>v1[1001],v3[200005],prime;
map<ll,ll>mp,mp2,mp3;
map<ll,vector<ll>>mp1;
map<char,ll>mp4;
string s,s1,s2;
priority_queue<ll>pq,pr;
stack<ll>st;
int main()
{
    fast;
    cin>>t;
    while(t--)
    {
        cin>>n>>s;
        s1="SeriousOJ";
        m=s1.size();
        bool ok=false;
        for(int i=0,j=0;i<n;i++)
        {
            if(s[i]==s1[j]) j++;
            if(j==m) ok=true;
        }
        if(ok) cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1147 SeriousOJ Challenge
Language
C++17 (G++ 13.2.0)
Submit At
2024-12-10 14:56:58
Judged At
2024-12-10 14:56:58
Judged By
Score
100
Total Time
5ms
Peak Memory
6.527 MiB