Submission #990089

#TimeUsernameProblemLanguageResultExecution timeMemory
990089haiphong5g0Boxes with souvenirs (IOI15_boxes)C++14
0 / 100
74 ms156936 KiB
#include <bits/stdc++.h> #define task "CAU5" #define pl pair<ll, ll> #define pb push_back #define mp make_pair #define fi first #define se second #define FOR(i, a, b, c) for (ll i=a; i<=b; i+=c) #define FORE(i, a, b, c) for (ll i=a; i>=b; i+=c) using namespace std; using ll = long long; using ull = unsigned long long; const ll Mod = 998244353; const int maxn = 1e7; const ll Inf = 1e16; ll delivery(int n,int k, int l, int A[]) { ll L[maxn+1], R[maxn+1], ans = Inf; FOR(i, 1, n, 1) { ll ans = Inf; L[i] = (i >= k ? L[i-k] : 0) + A[i-1]*2; R[i] = (i >= k ? R[i-k] : 0) + (l - A[n-i])*2; } FOR(i, 0, n, 1) ans = min(ans, L[i] + R[n-i]); FOR(i, 0, n-k, 1) ans = min(ans, L[i] + R[n-i-k] + k); return ans; } /*int main() { ios_base::sync_with_stdio(NULL); cin.tie(nullptr); cout.tie(nullptr); int t; ///Setup(); for (t=1; t--;) { ///Read(); cout << delivery(n, k, l, A); } }*/

Compilation message (stderr)

boxes.cpp: In function 'll delivery(int, int, int, int*)':
boxes.cpp:20:12: warning: declaration of 'ans' shadows a previous local [-Wshadow]
   20 |         ll ans = Inf;
      |            ^~~
boxes.cpp:18:30: note: shadowed declaration is here
   18 |     ll L[maxn+1], R[maxn+1], ans = Inf;
      |                              ^~~
boxes.cpp:20:12: warning: unused variable 'ans' [-Wunused-variable]
   20 |         ll ans = Inf;
      |            ^~~
#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...