Submission #974816

#TimeUsernameProblemLanguageResultExecution timeMemory
974816marinalucaBoxes with souvenirs (IOI15_boxes)C++14
0 / 100
2 ms2396 KiB
#include <bits/stdc++.h> using namespace std; //#define int long long #define ll long long #define xx first #define yy second #define all (x) begin(x), end(x) #define FOR (i, a, b) for (auto i = (a); i < (b); ++ i) const int NMAX = 1e7; int ans[NMAX + 1], rez[NMAX + 1]; long long delivery (int n, int k, int l, int s[]){ for (int i = 1; i <= n; ++ i){ ans[i] = min (s[i - 1] * 2 , l); if (i > k){ ans[i] += ans[i - k]; } } int mini; for (int i = n - 1; i >= 0; -- i){ rez[i] = min ((l - s[i]) * 2, l); if (i < n - k){ rez[i] += rez[i + k]; } mini = min (mini, rez[i] + ans[i]); } return mini; }

Compilation message (stderr)

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:28:12: warning: 'mini' may be used uninitialized in this function [-Wmaybe-uninitialized]
   28 |     return mini;
      |            ^~~~
#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...