# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
714077 | mseebacher | Boxes with souvenirs (IOI15_boxes) | C++17 | 489 ms | 209580 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
#define MAXI (int)1e5
#define pb(x) push_back(x)
vector<int> ad[MAXI];
vector<bool> vis(MAXI,0);
void dfs(int x){
if(vis[x]) return;
vis[x] = 1;
for(auto s:ad[x]){
dfs(s);
}
}
void setIO(string s) {
freopen((s + ".in").c_str(), "r", stdin);
freopen((s + ".out").c_str(), "w", stdout);
}
ll delivery(int n,int k,int l,int pos[]){
ll ans = 1e18;
vector<ll> pref(n+1,0);
vector<ll> suff(n+2,0);
for(int i = 1;i<=n;i++) pref[i] = 2*pos[i-1] + pref[(max(0,i-k))];
for(int i = n;i>0;i--) suff[i] = 2*(l-pos[i-1]) + suff[min(n+1,i+k)];
for(int i = 0;i<=n;i++){
ans = min(ans,pref[i]+suff[i+1]);
ans = min(ans,pref[i]+l+suff[min(n+1,i+k+1)]);
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |