Submission #886420

#TimeUsernameProblemLanguageResultExecution timeMemory
886420heavylightdecompBoxes with souvenirs (IOI15_boxes)C++14
10 / 100
1 ms600 KiB
//Assigning each person to a "half" #include "boxes.h" #include <bits/stdc++.h> using namespace std; #define ll long long long long delivery(int N, int K, int L, int p[]) { ll obvious = L; ll lef = 0; ll rig = L; for(int i = 0; i < N; i++) { if(p[i] <= L/2) { lef = max(lef, (ll)p[i]); } else { rig = min(rig, (ll)p[i]); } } ll other = 2ll*lef + 2ll*(L-rig); return min(obvious, other); }

Compilation message (stderr)

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