Submission #1129190

#TimeUsernameProblemLanguageResultExecution timeMemory
1129190mnbvcxz123Klavir (COCI17_klavir)C++20
Compilation error
0 ms0 KiB
#include <stdio.h> #define N 1000000 #define MD 1000000007 int main() { static int aa[N], ff[N + 1], dp[N + 1]; int n, m, i, j; scanf("%d%d", &m, &n); for (i = 0; i < n; i++) scanf("%d", &aa[i]); ff[0] = -1, ff[1] = 0; for (i = -1, j = 0; j < n; i++, j++) { while (i >= 0 && aa[i] != aa[j]) i = ff[i]; ff[j + 1] = i + 1; dp[j + 1] = j == 0 ? m : ((long long) (dp[j] - dp[ff[j]] + MD) * m + dp[i + 1]) % MD; printf("%d\n", dp[j + 1]); } return 0;

Compilation message (stderr)

klavir.cpp: In function 'int main()':
klavir.cpp:21:18: error: expected '}' at end of input
   21 |         return 0;
      |                  ^
klavir.cpp:6:12: note: to match this '{'
    6 | int main() {
      |            ^
klavir.cpp:10:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |         scanf("%d%d", &m, &n);
      |         ~~~~~^~~~~~~~~~~~~~~~
klavir.cpp:12:22: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |                 scanf("%d", &aa[i]);
      |                 ~~~~~^~~~~~~~~~~~~~