Submission #840197

#TimeUsernameProblemLanguageResultExecution timeMemory
840197theagentbaraTreasure (info1cup19_treasure)C++17
100 / 100
5 ms872 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define dl double #define pb push_back #define MOD 1000000007 int main (){ vector<pair<char, int>> eng; ll a, b; string s; cin>>a>>b>>s; eng.pb({s[0], 1}); for(int i = 1; i < a; i++){ if(s[i] == eng.back().first){ eng.back().second++; if(eng.back().second == b){ eng.pop_back(); } } else{ eng.pb({s[i], 1}); } } for(auto k : eng){ for(int i = 0; i < k.second; i++){ cout<<k.first; } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...