# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
238779 | lakshith_ | Boxes with souvenirs (IOI15_boxes) | C++14 | 5 ms | 384 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 ll long long
#define f first
#define s second
using namespace std;
inline void io_setup(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
}
inline ll Min(ll a,ll b){ return a<b?a:b; }
inline ll Max(ll a,ll b){ return a>b?a:b; }
ll delivery(int n,int k,int L,int positions[]){
ll ans;
if(k==1){
ans = 0;
for(int i=0;i<n;i++){
ans += 2*Min(positions[i],L-positions[i]);
}
}else if(k==n){
pair<int,int> l,r;
for(int i=0;i<n;i++){
if(positions[i]<(L/2)){
l.f = Min(positions[i],l.f);
l.s = Max(positions[i],l.s);
}else{
r.f = Min(L-positions[i],r.f);
r.s = Max(L-positions[i],r.s);
}
}
ans = min(L,2*r.s+2*l.s);
}
return ans;
}
// int main(){
// io_setup();
// int arr[] = {5,98};
// cout << delivery(2,2,100,arr);
// }
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... |