제출 #122158

#제출 시각아이디문제언어결과실행 시간메모리
122158popovicirobert새로운 문제 (POI13_usu)C++14
100 / 100
162 ms39928 KiB
#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 = n / (k + 1); i >= 1; i--) { for(auto it : sol[i]) { cout << it << " "; } cout << "\n"; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...