/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 540.0 KiB
#2 Accepted 2ms 540.0 KiB
#3 Accepted 2ms 540.0 KiB
#4 Accepted 2ms 540.0 KiB
#5 Accepted 2ms 516.0 KiB
#6 Accepted 2ms 416.0 KiB
#7 Accepted 2ms 608.0 KiB
#8 Accepted 2ms 840.0 KiB

Code

#include <iostream>
using namespace std;

int main(){
	ios :: sync_with_stdio(false);
	cin.tie(0);
	
	int tc;
	cin>>tc;
	while(tc--){
		int n;
		cin>>n;
		string str;
		cin>>str;
		int j = 0;
		string ans = "SeriousOJ";
		for(int i=0;i<n;i++){
			if(str[i] == ans[j]){
				j++;
			}
		}
		if(j == 9) cout<<"YES\n";
		else cout<<"NO\n";
		/***
		string ans ="";
		// SeriousOJ
		for(int i=0;i<n;i++){
			if(str[i] == 'S' && ans.size() == 0){
				ans += str[i];
			}
			else if(str[i] == 'e' && ans.size() == 1){
				ans += str[i];
			}
			else if(str[i] == 'r' && ans.size() == 2){
				ans += str[i];
			}
			else if(str[i] == 'i' && ans.size() == 3){
				ans += str[i];
			}
			else if(str[i] == 'o' && ans.size() == 4){
				ans += str[i];
			}
			else if(str[i] == 'u' && ans.size() == 5){
				ans += str[i];
			}
			else if(str[i] == 's' && ans.size() == 6){
				ans += str[i];
			}
			else if(str[i] == 'O' && ans.size() == 7){
				ans += str[i];
			}
			else if(str[i] == 'J' && ans.size() == 8){
				ans += str[i];
			}
		}
		if(ans == "SeriousOJ"){
			cout<<"YES\n";
		}
		else{
			cout<<"NO\n";
		}
		***/
	}
	return 0;
}

Information

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