#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define lsb(x) (x & (-x))
using namespace std;
const int MAXN = (int) 1e6;
char str[MAXN + 1];
int sp[MAXN + 1], pos[MAXN + 1];
int main() {
//ifstream cin("A.in");
//ofstream cout("A.out");
int i, n, k;
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
cin >> n >> k >> (str + 1);
vector < vector <int> > sol(n / (k + 1) + 1);
int sz = 0, cur = 0;
for(i = 1; i <= n; i++) {
sz++;
sp[sz] = sp[sz - 1] + (str[i] == 'c');
pos[sz] = i;
if(sz >= k + 1 && sp[sz] - sp[sz - k - 1] == 1) {
cur++;
for(int j = k; j >= 0; j--) {
sol[cur].push_back(pos[sz - j]);
}
sz -= (k + 1);
}
}
for(i = 1; i <= n / (k + 1); i++) {
for(auto it : sol[i]) {
cout << it << " ";
}
cout << "\n";
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Incorrect |
2 ms |
384 KB |
Ruch numer 5 nie jest poprawny. |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
384 KB |
Ruch numer 10 nie jest poprawny. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
384 KB |
Ruch numer 200 nie jest poprawny. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
512 KB |
Output is correct |
2 |
Incorrect |
3 ms |
512 KB |
Ruch numer 9 nie jest poprawny. |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
16 ms |
3320 KB |
Ruch numer 10000 nie jest poprawny. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
24 ms |
4812 KB |
Ruch numer 10002 nie jest poprawny. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
47 ms |
9316 KB |
Ruch numer 5000 nie jest poprawny. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
67 ms |
12920 KB |
Ruch numer 4000 nie jest poprawny. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
160 ms |
40824 KB |
Ruch numer 500000 nie jest poprawny. |
2 |
Halted |
0 ms |
0 KB |
- |