Submission #129805

#TimeUsernameProblemLanguageResultExecution timeMemory
129805DodgeBallManBoxes with souvenirs (IOI15_boxes)C++14
0 / 100
2 ms376 KiB
#include <bits/stdc++.h> #include "boxes.h" using namespace std; const int N = 1e6 + 10; long long ans, dpr[N], dpl[N]; int n, k, l, p[N]; long long delivery( int N, int K, int L, int P[] ) { n = n, k = k, l = l; for( int i = 1 ; i <= n ; i++ ) p[i] = P[i-1]; for( int i = 1 ; i <= n ; i++ ) dpr[i] = p[i] * 2 + dpr[max( 0, i - k )]; for( int i = n ; i >= 1 ; i-- ) dpl[i] = ( l - p[i] ) * 2 + dpl[min( l + 1, i + k )]; //for( int i = 1 ; i <= n ; i++ ) dpr[i] += dp[max( 0, i - k )]; //for( int i = n ; i >= 1 ; i-- ) dpl[i] += dp[min( l+1, i + k )]; for( int i = 0 ; i <= n ; i++ ) ans = min( ans, dpr[i] + dpl[i+1] ); return ans; }

Compilation message (stderr)

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:10:50: warning: declaration of 'N' shadows a global declaration [-Wshadow]
 long long delivery( int N, int K, int L, int P[] ) {
                                                  ^
boxes.cpp:6:11: note: shadowed declaration is here
 const int N = 1e6 + 10;
           ^
boxes.cpp:10:25: warning: unused parameter 'N' [-Wunused-parameter]
 long long delivery( int N, int K, int L, int P[] ) {
                         ^
boxes.cpp:10:32: warning: unused parameter 'K' [-Wunused-parameter]
 long long delivery( int N, int K, int L, int P[] ) {
                                ^
boxes.cpp:10:39: warning: unused parameter 'L' [-Wunused-parameter]
 long long delivery( int N, int K, int L, int P[] ) {
                                       ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...