Submission #968519

#TimeUsernameProblemLanguageResultExecution timeMemory
968519duckindogBoxes with souvenirs (IOI15_boxes)C++17
10 / 100
1 ms460 KiB
#include <bits/stdc++.h> using namespace std; #ifndef LOCAL #include "boxes.h" #endif long long delivery(int n, int k, int l, int p[]) { if (k == 1 || k == n) { long long answer = 0; for (int i = 0; i < n; ++i) answer += min(p[i], l - p[i]); if (k == 1) return answer << 1; return min(1ll * l, answer << 1); } } #ifdef LOCAL const int N = 10'000'000 + 10; int n, k, l; int p[N]; int32_t main() { cin.tie(0)->sync_with_stdio(0); cin >> n >> k >> l; for (int i = 0; i < n; ++i) cin >> p[i]; cout << delivery(n, k, l, p) << "\n"; } #endif

Compilation message (stderr)

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