Submission #520715

#TimeUsernameProblemLanguageResultExecution timeMemory
520715peti1234Boxes with souvenirs (IOI15_boxes)C++17
20 / 100
1 ms296 KiB
#include <bits/stdc++.h> using namespace std; long long delivery(int n, int k, int l, int a[]) { // 1 if (k==1) { long long valasz=0; for (int i=0; i<n; i++) { valasz+=2*min(a[i], l-a[i]); } return valasz; } // 2 if (k==2) { int bal=0, jobb=l; for (int i=0; i<n; i++) { if (2*a[i]<l) { bal=max(bal, a[i]); } else { jobb=min(jobb, a[i]); } } return min(l, 2*bal+2*(l-jobb)); } }

Compilation message (stderr)

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:26:1: warning: control reaches end of non-void function [-Wreturn-type]
   26 | }
      | ^
#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...