제출 #444478

#제출 시각아이디문제언어결과실행 시간메모리
444478Khizri선물상자 (IOI15_boxes)C++17
20 / 100
1 ms300 KiB
#include "boxes.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define F first #define S second #define INF 1e18 #define all(v) (v).begin(),(v).end() #define rall(v) (v).rbegin(),(v).rend() #define pii pair<int,int> #define pll pair<ll,ll> #define OK cout<<"Ok"<<endl; #define MOD (ll)(1e9+7) #define endl "\n" long long delivery(int n, int k, int l, int arr[]) { ll ans=0; if(k==1){ for(int i=0;i<n;i++){ ans+=min(arr[i],l-arr[i])*2; } return ans; } if(k==n){ sort(arr,arr+n); ans=min({arr[n-1]*2,(l-arr[0])*2,l}); arr[n]=l; for(int i=0;i<n;i++){ ans=min(ans,arr[i]*2ll+(l-arr[i+1])*2ll); } return ans; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...