답안 #840197

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
840197 2023-08-31T08:07:51 Z theagentbara Treasure (info1cup19_treasure) C++17
100 / 100
5 ms 872 KB
#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; 
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 300 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 300 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 300 KB Output is correct
11 Correct 1 ms 300 KB Output is correct
12 Correct 1 ms 304 KB Output is correct
13 Correct 1 ms 304 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 0 ms 340 KB Output is correct
16 Correct 1 ms 308 KB Output is correct
17 Correct 2 ms 444 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 2 ms 468 KB Output is correct
20 Correct 2 ms 468 KB Output is correct
21 Correct 2 ms 468 KB Output is correct
22 Correct 2 ms 572 KB Output is correct
23 Correct 2 ms 568 KB Output is correct
24 Correct 4 ms 740 KB Output is correct
25 Correct 4 ms 740 KB Output is correct
26 Correct 5 ms 840 KB Output is correct
27 Correct 5 ms 836 KB Output is correct
28 Correct 4 ms 852 KB Output is correct
29 Correct 5 ms 872 KB Output is correct
30 Correct 4 ms 868 KB Output is correct
31 Correct 4 ms 840 KB Output is correct
32 Correct 4 ms 868 KB Output is correct
33 Correct 4 ms 864 KB Output is correct
34 Correct 4 ms 852 KB Output is correct
35 Correct 4 ms 852 KB Output is correct