Submission #1034061

#TimeUsernameProblemLanguageResultExecution timeMemory
1034061ZicrusBoxes with souvenirs (IOI15_boxes)C++17
10 / 100
1 ms348 KiB
#include <bits/stdc++.h> #include "boxes.h" using namespace std; typedef long long ll; ll delivery(int n, int k, int l, int p11[]) { vector<ll> p(n); for (int i = 0; i < n; i++) p[i] = p11[i]; ll fR = lower_bound(p.begin(), p.end(), l/2) - p.begin(); if (fR == 0) return 2*(l-p[fR]); ll fL = fR-1; if (fL == n-1) return 2*p[fL]; return p[fL] + l-p[fR] + min(p[fR]-p[fL], l-(p[fR]-p[fL])); }

Compilation message (stderr)

boxes.cpp: In function 'll delivery(int, int, int, int*)':
boxes.cpp:7:24: warning: unused parameter 'k' [-Wunused-parameter]
    7 | ll delivery(int n, int k, int l, int p11[]) {
      |                    ~~~~^
#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...