# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
132277 | reda | 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<bits/stdc++.h>
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#include"boxes.h"
using namespace std ;
int delivery( int n , int k , int l , vector<int> pos)
{
if(k==1){
size_t gg = pos.size();
vector<int> arr(gg);
for(int i=0;i<pos.size();i++)
{
arr[i]=MIN(-pos[i]+l , pos[i] );
}
int c=0;
while (*min_element(arr.begin(),arr.end())!= (int)1e9)
{
//cout<<*min_element(pos.begin(),pos.end())<<endl;
c+=*min_element(arr.begin(),arr.end())*2;
*min_element(arr.begin(),arr.end())=(int)1e9;
}
return c;
}
return 0;
}/*
int main ()
{
cout<<delivery(3,1,8,{1,2,5});
}/*