# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
525331 |
2022-02-11T10:50:45 Z |
l3nl3 |
JJOOII 2 (JOI20_ho_t2) |
C++17 |
|
1 ms |
204 KB |
//#pragma GCC optimize("O3")
//#pragma GCC target ("avx2")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define int long long
#define all(a) a.begin(), a.end()
using namespace std;
const int N = 2e5 + 7;
int n, k, mn = 1e18;
string s;
signed main () {
ios_base::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
cin >> n >> k >> s;
s = '~' + s;
for (int i = 1; i <= n; i++) {
int J = 0, O = 0, I = 0, res = 0;
vector<int> aa;
for (int j = i + 1; j <= n; j++) {
if (s[j] == 'J') {
if (J == 2) {
res++;
aa.push_back(j);
continue;
}
J++;
}
if (s[j] == 'O') {
if (O == 2 || J < 2) {
res++;
aa.push_back(j);
continue;
}
O++;
}
if (s[j] == 'I') {
if (I == 2 || O < 2 || J < 2) {
res++;
aa.push_back(j);
continue;
}
I++;
}
}
int l = n, p = aa.size() - 1;
while (p >= 0 && aa[p] == l) {
l--;
p--;
res--;
}
if (J == 2 && O == 2 && I == 2) mn = min(mn, res);
}
cout << mn;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |