# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1122750 | SulA | JJOOII 2 (JOI20_ho_t2) | C++20 | 8 ms | 1812 KiB |
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
//#pragma GCC target("popcnt")
using namespace __gnu_pbds;
using namespace std;
using ordered_set = tree<int, null_type, less_equal<>, rb_tree_tag, tree_order_statistics_node_update>;
#define popcount __builtin_popcountll
#define all(a) (a).begin(), (a).end()
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int n,k; cin >> n >> k;
string s; cin >> s;
vector<int> J, O, I;
for (int i = 0; i < n; i++) {
if (s[i] == 'J') J.push_back(i);
else if (s[i] == 'O') O.push_back(i);
else I.push_back(i);
}
int ans = 1e9;
for (int l = 0, r = k-1; r < O.size(); l++, r++) {
int first = O[l];
int cnt_J = lower_bound(all(J), first) - begin(J);
if (cnt_J < k) continue;
first = J[cnt_J - k];
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |