이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "boxes.h"
using namespace std;
typedef long long ll;
typedef vector<int> vi;
ll delivery(int n, int k, int L, int positions[]){
ll l=(ll)L;
if(k==1){
ll ans=0;
for(int i=0; i<n; i++){
ans+=min(positions[i],L-positions[i])*2;
}
return ans;
}
if(k==n){
vi pos;
set<ll> z;
for(int i=0; i<n; i++){
int size=(int)z.size();
z.insert(positions[i]);
if((int)z.size()!=size){
pos.push_back(positions[i]);
}
}
int x = (int)(lower_bound(pos.begin(), pos.end(), l/2) - pos.begin());
int y = (int)(upper_bound(pos.begin(), pos.end(), l/2) - pos.begin());
x--;
long long ans=0;
ans+=pos[x]*2;
ans+=(n-pos[y])*2;
ans=min(l, ans);
return ans;
}
return 0;
}
# | 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... |