Submission #364030

#TimeUsernameProblemLanguageResultExecution timeMemory
364030wind_reaperBoxes with souvenirs (IOI15_boxes)C++17
0 / 100
1 ms364 KiB
#include "boxes.h" #include <bits/stdc++.h> using namespace std; #define dbg(x) cout << "[" << #x << ": " << x << "] "; long long delivery(int N, int k, int l, int p[]) { vector<long long> pref(N+2), suf(N+2), x(N+2); long long L = 1LL*l; x[0] = 0; for(int i = 1; i <= N; i++) x[i] = (long long)p[i-1]; x[N+1] = L; pref[0] = 0; for(int i = 1; i <= N + 1; i++) pref[i] = (i > k ? pref[i-k] + min(L, 2*x[i]) : x[i]); suf[N+1] = 0; for(int i = N; i >= 0; --i) suf[i] = (i <= N-k-1 ? suf[i+k] + min(2*(L - x[i]), L) : L - x[i]); long long ans = 1e18; for(int i = 0; i < N+1; i++) ans = min(ans, pref[i] + suf[i+1] + L - x[i+1] + x[i]); return ans; }

Compilation message (stderr)

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:21:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   21 |     for(int i = N; i >= 0; --i)
      |     ^~~
boxes.cpp:24:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   24 |  long long ans = 1e18;
      |  ^~~~
#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...