Submission #235698

# Submission time Handle Problem Language Result Execution time Memory
235698 2020-05-29T12:13:02 Z abacaba Boxes with souvenirs (IOI15_boxes) C++14
Compilation error
0 ms 0 KB
ll dp[2][N];

long long delivery(int n, int k, int l, int p[]) {
	for(int i = 0; i < n; ++i) {
		if(i < k)
			dp[0][i] = 2 * p[i];
        else
            dp[0][i] = dp[0][i-k] + 2 * p[i];
	}
    for(int i = n - 1; i >= 0; --i) {
        if(i + k >= n)
            dp[1][i] = 2 * (l - p[i]);
        else
            dp[1][i] = dp[1][i + k] + 2 * (l - p[i]);
    }
    ll ans = min(dp[0][n-1], dp[1][0]);
    for(int i = 1; i + 1 < n; ++i)
        ans = min(ans, dp[0][i-1] + min(p[i+1], l - p[i-1]) + dp[1][i+1]);
    for(int i = 0; i + 1 < n; ++i)
        ans = min(ans, dp[0][i] + dp[1][i+1]);
    return ans;
}

Compilation message

boxes.cpp:1:1: error: 'll' does not name a type
 ll dp[2][N];
 ^~
boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:6:4: error: 'dp' was not declared in this scope
    dp[0][i] = 2 * p[i];
    ^~
boxes.cpp:6:4: note: suggested alternative: 'p'
    dp[0][i] = 2 * p[i];
    ^~
    p
boxes.cpp:8:13: error: 'dp' was not declared in this scope
             dp[0][i] = dp[0][i-k] + 2 * p[i];
             ^~
boxes.cpp:8:13: note: suggested alternative: 'p'
             dp[0][i] = dp[0][i-k] + 2 * p[i];
             ^~
             p
boxes.cpp:12:13: error: 'dp' was not declared in this scope
             dp[1][i] = 2 * (l - p[i]);
             ^~
boxes.cpp:12:13: note: suggested alternative: 'p'
             dp[1][i] = 2 * (l - p[i]);
             ^~
             p
boxes.cpp:14:13: error: 'dp' was not declared in this scope
             dp[1][i] = dp[1][i + k] + 2 * (l - p[i]);
             ^~
boxes.cpp:14:13: note: suggested alternative: 'p'
             dp[1][i] = dp[1][i + k] + 2 * (l - p[i]);
             ^~
             p
boxes.cpp:16:5: error: 'll' was not declared in this scope
     ll ans = min(dp[0][n-1], dp[1][0]);
     ^~
boxes.cpp:16:5: note: suggested alternative: 'l'
     ll ans = min(dp[0][n-1], dp[1][0]);
     ^~
     l
boxes.cpp:18:9: error: 'ans' was not declared in this scope
         ans = min(ans, dp[0][i-1] + min(p[i+1], l - p[i-1]) + dp[1][i+1]);
         ^~~
boxes.cpp:18:24: error: 'dp' was not declared in this scope
         ans = min(ans, dp[0][i-1] + min(p[i+1], l - p[i-1]) + dp[1][i+1]);
                        ^~
boxes.cpp:18:24: note: suggested alternative: 'p'
         ans = min(ans, dp[0][i-1] + min(p[i+1], l - p[i-1]) + dp[1][i+1]);
                        ^~
                        p
boxes.cpp:18:37: error: 'min' was not declared in this scope
         ans = min(ans, dp[0][i-1] + min(p[i+1], l - p[i-1]) + dp[1][i+1]);
                                     ^~~
boxes.cpp:18:15: error: 'min' was not declared in this scope
         ans = min(ans, dp[0][i-1] + min(p[i+1], l - p[i-1]) + dp[1][i+1]);
               ^~~
boxes.cpp:20:9: error: 'ans' was not declared in this scope
         ans = min(ans, dp[0][i] + dp[1][i+1]);
         ^~~
boxes.cpp:20:24: error: 'dp' was not declared in this scope
         ans = min(ans, dp[0][i] + dp[1][i+1]);
                        ^~
boxes.cpp:20:24: note: suggested alternative: 'p'
         ans = min(ans, dp[0][i] + dp[1][i+1]);
                        ^~
                        p
boxes.cpp:20:15: error: 'min' was not declared in this scope
         ans = min(ans, dp[0][i] + dp[1][i+1]);
               ^~~
boxes.cpp:21:12: error: 'ans' was not declared in this scope
     return ans;
            ^~~