답안 #869785

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
869785 2023-11-05T16:28:58 Z rainboy Treasure (info1cup19_treasure) C
100 / 100
2 ms 1060 KB
#include <stdio.h>

#define N	200000

int main() {
	static char cc[N + 1];
	static int kk[N];
	int n, n_, k, i;

	scanf("%d%d%s", &n, &k, cc);
	n_ = 0;
	for (i = 0; i < n; i++) {
		cc[n_] = cc[i], kk[n_] = (n_ == 0 || cc[n_ - 1] != cc[i] ? 0 : kk[n_ - 1]) + 1, n_++;
		if (kk[n_ - 1] == k)
			n_ -= k;
	}
	cc[n_] = 0;
	printf("%s\n", cc);
	return 0;
}

Compilation message

treasure.c: In function 'main':
treasure.c:10:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |  scanf("%d%d%s", &n, &k, cc);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 604 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 1 ms 500 KB Output is correct
20 Correct 1 ms 496 KB Output is correct
21 Correct 1 ms 600 KB Output is correct
22 Correct 1 ms 436 KB Output is correct
23 Correct 1 ms 604 KB Output is correct
24 Correct 1 ms 604 KB Output is correct
25 Correct 1 ms 604 KB Output is correct
26 Correct 1 ms 1060 KB Output is correct
27 Correct 1 ms 860 KB Output is correct
28 Correct 1 ms 860 KB Output is correct
29 Correct 2 ms 860 KB Output is correct
30 Correct 1 ms 860 KB Output is correct
31 Correct 1 ms 860 KB Output is correct
32 Correct 2 ms 860 KB Output is correct
33 Correct 1 ms 860 KB Output is correct
34 Correct 1 ms 604 KB Output is correct
35 Correct 1 ms 688 KB Output is correct