# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
396944 | Andyvanh1 | Boxes with souvenirs (IOI15_boxes) | C++14 | 0 ms | 0 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 <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
using namespace std;
#define pb push_back
#define INF INT32_MAX
#define vt vector
typedef vt<int> vi;
typedef pair<int,int> pii;
typedef tuple<int,int,int> tiii;
typedef long long ll;
ll delivery(int n, int k, int l, vi arr){
if(k==1){
ll ans = 0;
for(int i = 0; i < n; i++){
ans+=2*min(arr[i],l-arr[i]);
}
return ans;
}else if(k==n){
if(arr[n-1]<=l/2){
return arr[n-1]*2;
}else if(arr[0]>l/2){
return 2* (l-arr[0]);
}else{
return l;
}
}
return 0;
}