Submission #64883

#TimeUsernameProblemLanguageResultExecution timeMemory
64883TalantBoxes with souvenirs (IOI15_boxes)C++17
10 / 100
3 ms376 KiB
#include "boxes.h" //#include "grader.cpp" #include <bits/stdc++.h> #define mk make_pair #define sc second #define fr first #define pb push_back using namespace std; const int N = (1e6 + 5); const int inf = (1e9 + 7); long long ans; long long delivery(int N, int K, int L, int p[]) { if (K == 1) { for (int i = 0; i < N; i ++) ans += min(p[i] * 2,(L - p[i]) * 2); } else if (K == N) { ans = L; for (int i = 0; i < N; i ++) ans = min(ans,(long long)(p[i] * 2 + (L - p[i + 1]) * 2)); ans = min(ans,(long long)(L - p[0]) * 2); } return ans; }

Compilation message (stderr)

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:18:48: warning: declaration of 'N' shadows a global declaration [-Wshadow]
 long long delivery(int N, int K, int L, int p[]) {
                                                ^
boxes.cpp:13:11: note: shadowed declaration is here
 const int N = (1e6 + 5);
           ^
#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...