Submission #740557

#TimeUsernameProblemLanguageResultExecution timeMemory
740557JellyTheOctopusTake-out (POI13_usu)C++17
0 / 100
206 ms36256 KiB
#include <bits/stdc++.h> using namespace std; int N, K; int main() { cin >> N >> K; vector<bool> arr(N+1); // White is False, Black is True string s; cin >> s; for (int i = 0; i < N; i++) { arr[i+1] = (s[i] == 'c'); } stack<int> white, black; vector<vector<int>> ans; for (int i = 1; i <= N; i++) { if (arr[i]) { black.push(i); } else { white.push(i); } if (((int)white.size() >= K) && (!black.empty())) { vector<int> cur; cur.push_back(black.top()); black.pop(); for (int j = 1; j <= K; j++) { cur.push_back(white.top()); white.pop(); } sort(cur.begin(), cur.end()); ans.push_back(cur); } } for (int i = 0; i < N/(K+1); i++) { for (auto v: ans[i]) { cout << v << " "; } 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...