| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1343434 | minhtien | JJOOII 2 (JOI20_ho_t2) | C++20 | 1 ms | 344 KiB |
#include <bits/stdc++.h>
using namespace std;
const int N=2e5+6;
int n,k;
string s;
int main()
{
cin >> n >>k;
int k1=k,k2=k;
cin >>s;
s=" "+s;
string t="";
while(k--){
t+="J";
}
while(k1--){
t+="O";
}
while(k2--){
t+="I";
}
int n1=t.size();
t=" "+t;
int j=1;
int dem=0;
int i=1;
while(i<=n && j<=n1){
if(s[i]!=t[j]){
i++;
if(j>1 && j!=n1){
dem++;
}
else if(j>n1){
dem++;
}
}
else{
i++;
j++;
}
}
if(j>n1){
cout << dem;
}
else cout << -1;
return 0;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
