# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
363606 | 2021-02-06T16:51:14 Z | Sparky_09 | Boxes with souvenirs (IOI15_boxes) | C++17 | 1 ms | 512 KB |
#include "bits/stdc++.h" using namespace std; #define rep(i, a, b) for(int i = a; i < (b); ++i) #define all(x) begin(x), end(x) #define trav(a, x) for(auto& a : x) #define sz(x) (int)(x).size() typedef long long ll; typedef pair<ll, ll> pii; typedef vector<ll> vi; typedef vector<pii> vpi; void usaco(string s){ freopen((s+".in").c_str(), "r", stdin); freopen((s+".out").c_str(), "w", stdout); } const int maxn = 1e7+1000; ll n1, k1, l1; ll pre[maxn], suf[maxn], pos1[maxn]; int delivery(int n, int k, int l, int pos[]){ n1=n;k1=k;l1=l; for(int i = 0; i < n; i++) pos1[i] = pos[i]; for(int i = 0; i < n; i++){ pre[i] = (i>=k?pre[i-k]+min(l1,2*pos1[i]):min(l1,2*pos1[i])); } for(int i = n-1; i >= 0; i--){ suf[i] = (i<=n-1-k?suf[i+k]+min(l1,2*(l1-pos1[i])):min(l1,2*(l1-pos1[i]))); } ll ans = min(pre[0],suf[0]); for(int i = 0; i < n; i++){ ans = min(ans, pre[i] + suf[i+1]); } return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Incorrect | 1 ms | 364 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 512 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 364 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Incorrect | 1 ms | 364 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Incorrect | 1 ms | 364 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Incorrect | 1 ms | 364 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |