# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
747678 | Sami_Massah | JJOOII 2 (JOI20_ho_t2) | C++17 | 1 ms | 212 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
const long long maxn = 3e3 + 12, mod = 1e9 + 7, inf = 1e9 + 12 ;
long long n, k;
string s;
int main(){
cin >> n >> k;
cin >> s;
int l, r;
int cnt = 0;
for(int i = n - 1; cnt < k && i >= 0; i--)
if(s[i] == 'I'){
cnt += 1;
r = i;
}
cnt = 0;
for(int i = 0; i < n && cnt < k; i++)
if(s[i] == 'J'){
cnt += 1;
l = i;
}
cnt = 0;
for(int i = l + 1; i < r; i++)
if(s[i] == 'O')
cnt += 1;
if(cnt != k){
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |