Submission #674403

#TimeUsernameProblemLanguageResultExecution timeMemory
674403QwertyPiTreasure (info1cup19_treasure)C++14
100 / 100
8 ms1092 KiB
#include <bits/stdc++.h> using namespace std; const int MAXN = 2e5 + 11; int main(){ int n, k; cin >> n >> k; string s; cin >> s; vector<int> eq; eq.push_back(0); string ans; char pv = -1; for(auto c : s){ if(c == pv) eq.push_back(eq.back() + 1); else eq.push_back(1); ans.push_back(c); if(eq.back() >= k){ for(int i = 0; i < k; i++) ans.pop_back(), eq.pop_back(); pv = ans.empty() ? -1 : ans.back(); }else{ pv = c; } } cout << ans << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...