Compile Error
foo.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
Code
#include <iostream>
#include <string>
using namespace std;
// Function to check if "SeriousOJ" is a subsequence of S
bool isSubsequence(const string& S, const string& target) {
int targetIndex = 0;
int targetLen = target.length();
for (char ch : S) {
if (ch == target[targetIndex]) {
targetIndex++;
if (targetIndex == targetLen) {
return true;
}
}
}
return false;
}
int main() {
int T;
cin >> T; // Number of test cases
string target = "SeriousOJ";
string result;
while (T--) {
int N;
cin >> N; // Length of the string S
string S;
cin >> S;
if (isSubsequence(S, target)) {
result += "YES\n";
} else {
result += "NO\n";
}
}
cout << result;
return 0;
}
Information
- Submit By
- Type
- Submission
- Problem
- P1147 SeriousOJ Challenge
- Contest
- LU IUJPC : Sylhet Division 2024 Replay Contest
- Language
- C99 (GCC 13.2.0)
- Submit At
- 2024-12-10 10:58:34
- Judged At
- 2024-12-10 10:58:34
- Judged By
- Score
- 0
- Total Time
- 0ms
- Peak Memory
- 0 Bytes