# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
901246 | Codeuss | Treasure (info1cup19_treasure) | C++17 | 17 ms | 1116 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define NMAX 200001
char stiv[NMAX];
int main(void){
int n , k, top = 0;
string s;
cin >> n >> k;
cin >> s;
for(int i= 0;i<s.size();i++){
int cnt1 = 0, top_aux = top;
//cout << top << ' ';
while(top_aux && stiv[top_aux] == s[i]){
top_aux--;
cnt1++;
}
// cout << top_aux << '\n';
if(cnt1 + 1 == k){
top = top_aux;
}else
stiv[++top] = s[i];
}
for(int i = 1;i<=top;i++){
cout << stiv[i];
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |