Submission #869785

#TimeUsernameProblemLanguageResultExecution timeMemory
869785rainboyTreasure (info1cup19_treasure)C11
100 / 100
2 ms1060 KiB
#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 (stderr)

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);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...