| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 701053 | Richem | JJOOII 2 (JOI20_ho_t2) | C++14 | 0 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 <iostream>
using namespace std;
const int INF = 1e9;
int taille, niveau;
string mot;
int main() {
cin >> taille >> niveau;
cin >> mot;
int rep = INF;
for(int deb = 0; deb < taille; deb++) {
if(mot[deb] != 'J') {
continue;
}
int curId = deb;
int nbJ = 0;
int total = 0;
while(curId < taille && nbJ < niveau) {
nbJ += (mot[curId++] == 'J');
total++;
}
if(nbJ != niveau) {
continue;
}
int nbO = 0;
while(curId < taille && nbO < niveau) {
nbO += (mot[curId++] == 'O');
total++;
}
if(nbO != niveau) {
continue;
}
int nbI = 0;
while(curId < taille && nbI < niveau) {
nbI += (mot[curId++] == 'I');
}
if(nbI == niveau) {
rep = min(rep, total - 2 * niveau);
}
}
if(rep == INF) {
cout << "-1";
}
else {
cout << rep;
}
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
