제출 #380137

#제출 시각아이디문제언어결과실행 시간메모리
380137Theo830선물상자 (IOI15_boxes)C++17
10 / 100
1 ms512 KiB
#include "boxes.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll,ll> ii; #define iii pair<ll,ii> #define f(i,a,b) for(int i = a;i < b;i++) #define pb push_back #define vll vector<ll> #define F first #define S second #define all(x) (x).begin(), (x).end() ///I hope I will get uprating and don't make mistakes ///I will never stop programming ///sqrt(-1) Love C++ ///Please don't hack me ///@TheofanisOrfanou Theo830 ///Think different approaches (bs,dp,greedy,graphs,shortest paths,mst) ///Stay Calm ///Look for special cases ///Beware of overflow and array bounds ///Think the problem backwards ///Training ll delivery(int n, int k, int l, int arr[]) { ll ans = 0; if(k == 1){ f(i,0,n){ ans += 2 * min(l - arr[i],arr[i]); } } else if(k == n){ sort(arr,arr+n); if(arr[n-1] != 0){ ans = l; } ans = min(ans,2LL * arr[n-1]); ans = min(ans,2LL * (n - arr[0])); } return ans; }
#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...