Submission #1032573

#TimeUsernameProblemLanguageResultExecution timeMemory
1032573socpiteBoxes with souvenirs (IOI15_boxes)C++17
10 / 100
1 ms600 KiB
#include "boxes.h" #include<bits/stdc++.h> using namespace std; const int maxn = 1e7+5; const long long INF = 1e18; long long cnt[maxn], ans[maxn], dp[maxn]; long long delivery(int N, int K, int L, int p[]) { sort(p, p+N); long long re = 0; for(int i = 0; i < N; i++){ re += 2*min(p[i], L - p[i]); } // if(N == 0)return 0; // int crr = 0; // for(int i = 0; i < N; i++){ // if(p[i]==0)continue; // dp[crr++%K] += p[i] + min(p[i], L - p[i]); // ans[crr] = dp[(crr-1)%K]; // } // memset(dp, 0, sizeof(dp)); // crr = 0; // for(int i = N-1; i >= 0; i--){ // if(p[i]==0)continue; // dp[crr++%K] += L - p[i] + min(p[i], L - p[i]); // re = min(re, dp[(crr-1)%K] + ans[N - crr]); // } return re; }

Compilation message (stderr)

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:10:31: warning: unused parameter 'K' [-Wunused-parameter]
   10 | 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...