# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
520952 | LucaIlie | Treasure (info1cup19_treasure) | C++17 | 17 ms | 668 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 <iostream>
#include <stack>
#include <vector>
using namespace std;
struct aaa {
char val;
int rep;
};
stack <aaa> s;
vector <char> v;
int main() {
char a;
int n, k, i;
cin >> n >> k;
for ( i = 0; i < n; i++ ) {
cin >> a;
if ( !s.empty() && s.top().val == a ) {
s.top().rep++;
if ( s.top().rep == k )
s.pop();
} else
s.push( { a, 1 } );
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |