# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1075243 | raduv | Treasure (info1cup19_treasure) | C++17 | 2 ms | 604 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define DEBUG 1
using namespace std;
const int MAXN = 200'000;
int stiva[MAXN + 1][2];
int ns;
int main() {
char ch;
int n, k, i;
scanf("%d%d ", &n, &k);
for( i = 0; i < n; i++ ){
ch = fgetc(stdin);
ch -= 'a';
if(ns > 0 && stiva[ns][0] == ch){
stiva[ns][1]++;
if(stiva[ns][1] == k){
stiva[ns][1] = 0;
stiva[ns][0] = 0;
ns--;
}
}
else{
ns++;
stiva[ns][0] = ch;
stiva[ns][1] = 1;
}
}
for( i = 1; i <= ns; i++ ){
while(stiva[i][1] > 0){
fputc(stiva[i][0] + 'a', stdout);
stiva[i][1]--;
}
}
fputc('\n', stdout);
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |