이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |