Submission #727906

#TimeUsernameProblemLanguageResultExecution timeMemory
727906Boycl07Boxes with souvenirs (IOI15_boxes)C++17
10 / 100
1 ms340 KiB
#include <bits/stdc++.h> #include "boxes.h" using namespace std; typedef long long ll; #define rep(i, n) for(int i = 1; i <= n; ++i) #define forn(i, l, r) for(int i = l; i <= r; ++i) #define ford(i, r, l) for(int i = r; i >= l; --i) #define fi first #define se second #define pii pair<int, int> #define pll pair<ll, ll> #define pb push_back #define endl "\n" #define C(x, y) make_pair(x, y) template<typename T> bool maximize(T &res, const T &val) { if (res < val){ res = val; return true; }; return false; } template<typename T> bool minimize(T &res, const T &val) { if (res > val){ res = val; return true; }; return false; } const int MN = 1e7 + 7; const int MOD = 1e9 + 7 ; const int INF = 1e13 + 9999; const int block_size = 230; const int LIM = 2e7; ll pre[MN], suf[MN]; long long delivery(int N, int K, int L, int p[]) { ll res = 1e18; rep(i, N) { pre[i] = pre[max(0, i - K)] + min(p[i - 1], L - p[max(1, i - K + 1) - 1]) + min(p[i - 1], L - p[i - 1]); } ford(i, N, 1) { suf[i] = suf[min(N + 1, i + K)] + min(L - p[i - 1], p[min(N, i + K - 1) - 1]) + min(p[i - 1], L - p[i - 1]); } rep(i, N) minimize(res, pre[i] + suf[i + 1]); return res; }

Compilation message (stderr)

boxes.cpp:23:22: warning: overflow in conversion from 'double' to 'int' changes value from '1.0000000009999e+13' to '2147483647' [-Woverflow]
   23 | const int INF = 1e13 + 9999;
      |                 ~~~~~^~~~~~
#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...