제출 #945371

#제출 시각아이디문제언어결과실행 시간메모리
945371rainboy새로운 문제 (POI13_usu)C11
100 / 100
98 ms20872 KiB
#include <stdio.h> #define N 1000000 int main() { static char cc[N + 1]; static int pp[N + 1], qu[N], ii[N]; int n, m, k, cnt, h, i; scanf("%d%d%s", &n, &k, cc); m = 0, cnt = 0; for (i = 0; i < n; i++) { if (cc[i] == 'c') pp[m + 1] = pp[m] + k, qu[m] = i, m++; else pp[m + 1] = pp[m] - 1, qu[m] = i, m++; if (m >= k + 1 && pp[m] == pp[m - k - 1]) { for (h = m - k - 1; h < m; h++) ii[cnt++] = qu[h]; m -= k + 1; } } for (h = n / (k + 1) - 1; h >= 0; h--) { for (i = h * (k + 1); i < (h + 1) * (k + 1); i++) printf("%d ", ii[i] + 1); printf("\n"); } return 0; }

컴파일 시 표준 에러 (stderr) 메시지

usu.c: In function 'main':
usu.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);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...