Wrong Answer
Code
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define nl endl
#define ss string
#define dl double
#define yes cout << "YES" << nl;
#define no cout << "NO" << nl;
int main() {
ll t; cin >> t;
while (t--)
{
/* code */
int n; cin >> n;
unordered_set<char> st;
// for (int j = 0; j < n; j++)
// {
// /* code */
// char c; cin >> c;
// st.insert(c);
// }
// for(auto x : st)
// {
// cout << x;
// }
// cout << nl;
ss s; cin >> s;
ss ck; ck = "SeriousOJ";
string ckk="";
for(int i = 0; i < s.size(); i++)
{
bool flag= true;
int n =ckk.length();
if(s[i] == 'S' || s[i] == 'e' || s[i] == 'r' ||
s[i] == 'i' || s[i] == 'o' || s[i] == 'u'
|| s[i] == 's' || s[i] == 'O' || s[i] == 'J')
{
for(int j = n-1; j>=0; j--)
{
if(ckk[j]==s[i])
{
flag=false;
break;
}
}
if(flag)
{
ckk.push_back(s[i]);
//flag=true;
}
}
}
if(ckk==ck)
yes
else
no
}
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:59:45
- Judged At
- 2024-12-09 05:59:45
- Judged By
- Score
- 10
- Total Time
- 7ms
- Peak Memory
- 588.0 KiB