Submission #567897

#TimeUsernameProblemLanguageResultExecution timeMemory
567897Trisanu_DasBoxes with souvenirs (IOI15_boxes)C++17
Compilation error
0 ms0 KiB
#include "boxes.h" #include <bits/stdc++.h> using namespace std; #define ll long long int; ll dp1[10000007]; ll dp2[10000007]; ll delivery(int n, int k, int l, int pos[]) { for (int i = 1;i <= n;i++) dp1[i]= dp1[max(0,i - k)] + 2 * pos[i - 1]; for (int i= n;i >= 1;i--) dp2[i]= dp2[min(n + 1,i + k)] + 2 * (l - pos[i - 1]); ll ans=1e18; for (int i = 1;i <= n + 1;i++) ans = min(ans, dp1[i - 1] + dp2[i]); for (int i = k;i <= n;i++) ans = min(ans,dp[i - k] + dp2[i + 1] + l); return ans; }

Compilation message (stderr)

boxes.cpp:4:22: error: declaration does not declare anything [-fpermissive]
    4 | #define ll long long int;
      |                      ^~~
boxes.cpp:6:1: note: in expansion of macro 'll'
    6 | ll dp1[10000007];
      | ^~
boxes.cpp:6:4: error: 'dp1' does not name a type
    6 | ll dp1[10000007];
      |    ^~~
boxes.cpp:4:22: error: declaration does not declare anything [-fpermissive]
    4 | #define ll long long int;
      |                      ^~~
boxes.cpp:7:1: note: in expansion of macro 'll'
    7 | ll dp2[10000007];
      | ^~
boxes.cpp:7:4: error: 'dp2' does not name a type
    7 | ll dp2[10000007];
      |    ^~~
boxes.cpp:4:22: error: declaration does not declare anything [-fpermissive]
    4 | #define ll long long int;
      |                      ^~~
boxes.cpp:9:1: note: in expansion of macro 'll'
    9 | ll delivery(int n, int k, int l, int pos[])
      | ^~
boxes.cpp:9:4: error: ISO C++ forbids declaration of 'delivery' with no type [-fpermissive]
    9 | ll delivery(int n, int k, int l, int pos[])
      |    ^~~~~~~~
boxes.cpp:9:4: error: ambiguating new declaration of 'int delivery(int, int, int, int*)'
In file included from boxes.cpp:1:
boxes.h:4:11: note: old declaration 'long long int delivery(int, int, int, int*)'
    4 | long long delivery(int N, int K, int L, int p[]);
      |           ^~~~~~~~
boxes.cpp: In function 'int delivery(int, int, int, int*)':
boxes.cpp:11:32: error: 'dp1' was not declared in this scope
   11 |     for (int i = 1;i <= n;i++) dp1[i]= dp1[max(0,i - k)] + 2 * pos[i - 1];
      |                                ^~~
boxes.cpp:12:32: error: 'dp2' was not declared in this scope
   12 |     for (int i=  n;i >= 1;i--) dp2[i]= dp2[min(n + 1,i + k)] + 2 * (l - pos[i - 1]);
      |                                ^~~
boxes.cpp:4:22: error: declaration does not declare anything [-fpermissive]
    4 | #define ll long long int;
      |                      ^~~
boxes.cpp:14:5: note: in expansion of macro 'll'
   14 |     ll ans=1e18;
      |     ^~
boxes.cpp:14:8: error: 'ans' was not declared in this scope; did you mean 'abs'?
   14 |     ll ans=1e18;
      |        ^~~
      |        abs
boxes.cpp:15:51: error: 'dp1' was not declared in this scope
   15 |     for (int i = 1;i <= n + 1;i++) ans = min(ans, dp1[i - 1] + dp2[i]);
      |                                                   ^~~
boxes.cpp:15:64: error: 'dp2' was not declared in this scope
   15 |     for (int i = 1;i <= n + 1;i++) ans = min(ans, dp1[i - 1] + dp2[i]);
      |                                                                ^~~
boxes.cpp:16:46: error: 'dp' was not declared in this scope
   16 |     for (int i = k;i <= n;i++) ans = min(ans,dp[i - k] + dp2[i + 1] + l);
      |                                              ^~
boxes.cpp:16:58: error: 'dp2' was not declared in this scope
   16 |     for (int i = k;i <= n;i++) ans = min(ans,dp[i - k] + dp2[i + 1] + l);
      |                                                          ^~~