Submission #932212

#TimeUsernameProblemLanguageResultExecution timeMemory
932212XiaoyangSplit the sequence (APIO14_sequence)C++17
Compilation error
0 ms0 KiB
intf("%d", sl[x][dep]); } return; } int main() { int i, l; scanf("%d%d", &n, &k); for(i=1; i<=n; ++i) scanf("%d", &a[i]); for(i=1; i<=n; ++i) s[i]=s[i-1]+a[i]; for(i=1; i<=n; ++i) d[i]=s[i]*s[i]; for(j=2; j<=k+1; ++j) { // get_l(j - 1, n-(k + 1 - j), j, n); for(i=j; i<=n; ++i) { l=sl[i][j]; dd[i]=d[l] + (s[i] - s[l])*(s[i] - s[l]); } for(i = j; i <= n; ++i) d[i]=dd[i]; } printf("%lld\n", (s[n] * s[n] - d[n])/2); back(n, k + 1); }

Compilation message (stderr)

sequence.cpp:1:5: error: expected constructor, destructor, or type conversion before '(' token
    1 | intf("%d", sl[x][dep]);
      |     ^
sequence.cpp:2:3: error: expected declaration before '}' token
    2 |   }
      |   ^
sequence.cpp:3:3: error: expected unqualified-id before 'return'
    3 |   return;
      |   ^~~~~~
sequence.cpp:4:1: error: expected declaration before '}' token
    4 | }
      | ^
sequence.cpp: In function 'int main()':
sequence.cpp:9:18: error: 'n' was not declared in this scope
    9 |   scanf("%d%d", &n, &k);
      |                  ^
sequence.cpp:9:22: error: 'k' was not declared in this scope
    9 |   scanf("%d%d", &n, &k);
      |                      ^
sequence.cpp:9:3: error: 'scanf' was not declared in this scope
    9 |   scanf("%d%d", &n, &k);
      |   ^~~~~
sequence.cpp:10:36: error: 'a' was not declared in this scope
   10 |   for(i=1; i<=n; ++i) scanf("%d", &a[i]);
      |                                    ^
sequence.cpp:11:23: error: 's' was not declared in this scope
   11 |   for(i=1; i<=n; ++i) s[i]=s[i-1]+a[i];
      |                       ^
sequence.cpp:11:35: error: 'a' was not declared in this scope
   11 |   for(i=1; i<=n; ++i) s[i]=s[i-1]+a[i];
      |                                   ^
sequence.cpp:12:23: error: 'd' was not declared in this scope
   12 |   for(i=1; i<=n; ++i) d[i]=s[i]*s[i];
      |                       ^
sequence.cpp:12:28: error: 's' was not declared in this scope
   12 |   for(i=1; i<=n; ++i) d[i]=s[i]*s[i];
      |                            ^
sequence.cpp:13:7: error: 'j' was not declared in this scope
   13 |   for(j=2; j<=k+1; ++j)
      |       ^
sequence.cpp:16:5: error: 'get_l' was not declared in this scope
   16 |     get_l(j - 1, n-(k + 1 - j), j, n);
      |     ^~~~~
sequence.cpp:19:11: error: 'sl' was not declared in this scope; did you mean 'l'?
   19 |         l=sl[i][j];
      |           ^~
      |           l
sequence.cpp:20:9: error: 'dd' was not declared in this scope
   20 |         dd[i]=d[l] + (s[i] - s[l])*(s[i] - s[l]);
      |         ^~
sequence.cpp:20:15: error: 'd' was not declared in this scope
   20 |         dd[i]=d[l] + (s[i] - s[l])*(s[i] - s[l]);
      |               ^
sequence.cpp:20:23: error: 's' was not declared in this scope
   20 |         dd[i]=d[l] + (s[i] - s[l])*(s[i] - s[l]);
      |                       ^
sequence.cpp:22:31: error: 'd' was not declared in this scope
   22 |       for(i = j; i <= n; ++i) d[i]=dd[i];
      |                               ^
sequence.cpp:22:36: error: 'dd' was not declared in this scope
   22 |       for(i = j; i <= n; ++i) d[i]=dd[i];
      |                                    ^~
sequence.cpp:24:21: error: 's' was not declared in this scope
   24 |   printf("%lld\n", (s[n] * s[n] - d[n])/2);
      |                     ^
sequence.cpp:24:35: error: 'd' was not declared in this scope
   24 |   printf("%lld\n", (s[n] * s[n] - d[n])/2);
      |                                   ^
sequence.cpp:24:3: error: 'printf' was not declared in this scope
   24 |   printf("%lld\n", (s[n] * s[n] - d[n])/2);
      |   ^~~~~~
sequence.cpp:1:1: note: 'printf' is defined in header '<cstdio>'; did you forget to '#include <cstdio>'?
  +++ |+#include <cstdio>
    1 | intf("%d", sl[x][dep]);
sequence.cpp:25:3: error: 'back' was not declared in this scope
   25 |   back(n, k + 1);
      |   ^~~~