제출 #1093163

#제출 시각아이디문제언어결과실행 시간메모리
1093163serifefedartar새로운 문제 (POI13_usu)C++17
100 / 100
112 ms40964 KiB
#include <bits/stdc++.h> using namespace std; #define fast ios::sync_with_stdio(0);cin.tie(0) typedef long long ll; #define f first #define s second #define LOGN 21 const ll MOD = 1e9 + 7; const ll MAXN = 1e6 + 100; int N, K, pref[MAXN], temp[MAXN]; vector<vector<int>> ans; string S; int main() { fast; cin >> N >> K >> S; S = "#" + S; int now = 0; for (int i = 1; i <= N; i++) { now++; pref[now] = pref[now-1] + (S[i] == 'c'); temp[now] = i; if (now >= K + 1 && pref[now] - pref[now - K - 1] == 1) { ans.push_back(vector<int>()); for (int j = now; j >= now - K; j--) ans.back().push_back(temp[j]); sort(ans.back().begin(), ans.back().end()); now -= K + 1; } } reverse(ans.begin(), ans.end()); for (auto v : ans) { for (auto q : v) cout << q << " "; cout << "\n"; } }
#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...