답안 #690888

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
690888 2023-01-30T14:45:45 Z MateiKing80 Treasure (info1cup19_treasure) C++14
100 / 100
68 ms 716 KB
#include <bits/stdc++.h>

using namespace std;
stack< pair<int,char> >st;
int main()
{
    int n,k;
    char ch;
    cin>>n>>k;
    while(cin>>ch)
    {
        if(st.empty() || st.top().second!=ch)
            st.push({1,ch});
        else
        {
            char a=st.top().second;
            int x=st.top().first;
            st.pop();
            st.push({x+1,a});
        }
        if(st.top().first==k)
            st.pop();
    }
    string s;
    while(!st.empty())
    {
        for(int i=0;i<st.top().first;i++)
            s=st.top().second+s;
        st.pop();
    }
    cout<<s;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 296 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 296 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 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 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 304 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 2 ms 316 KB Output is correct
17 Correct 4 ms 340 KB Output is correct
18 Correct 4 ms 340 KB Output is correct
19 Correct 6 ms 340 KB Output is correct
20 Correct 4 ms 340 KB Output is correct
21 Correct 7 ms 440 KB Output is correct
22 Correct 10 ms 416 KB Output is correct
23 Correct 11 ms 468 KB Output is correct
24 Correct 20 ms 588 KB Output is correct
25 Correct 16 ms 596 KB Output is correct
26 Correct 68 ms 704 KB Output is correct
27 Correct 59 ms 716 KB Output is correct
28 Correct 30 ms 656 KB Output is correct
29 Correct 45 ms 688 KB Output is correct
30 Correct 21 ms 716 KB Output is correct
31 Correct 19 ms 628 KB Output is correct
32 Correct 18 ms 520 KB Output is correct
33 Correct 17 ms 596 KB Output is correct
34 Correct 14 ms 524 KB Output is correct
35 Correct 14 ms 568 KB Output is correct