This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#pragma GCC diagnostic warning "-std=c++11"
#include <bits/stdc++.h>
#include "boxes.h"
#define pb push_back
#define f first
#define s second
#define MOD 1000000007
#define flush fflush(stdout)
#define all(x) (x).begin(),(x).end()
#define allr(x) (x).rbegin(), (x).rend()
#define pii pair<int,int>
using namespace std;
int n,m,T,k;
long long delivery(int N, int K, int L, int p[]) {
long long ans=0;
if (K==1) {
for (int i=0; i<N; i++) {
ans+=min(p[i],L-p[i])*2;
}
return ans;
}
vector<pii> v1,v2;
for (int i=0; i<N; i++) {
if (p[i]<L/2) v1.pb({p[i],i});
else v2.pb({p[i],i});
}
sort(all(v1)); sort(all(v2));
int l1=0,l2=0;
if (v1.size()) l1=v1.back().f;
if (v2.size()) l2=L-v2[0].f;
ans=min(L,l1*2+l2*2);
return ans;
}
Compilation message (stderr)
boxes.cpp:1:32: warning: '-std=c++11' is not an option that controls warnings [-Wpragmas]
1 | #pragma GCC diagnostic warning "-std=c++11"
| ^~~~~~~~~~~~
# | 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... |