Submission #705180

#TimeUsernameProblemLanguageResultExecution timeMemory
705180bin9638Boxes with souvenirs (IOI15_boxes)C++17
10 / 100
1 ms340 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define fs first #define sc second #define N 1010 #define pb push_back ll dp[1010][1010]; void selfmin(ll&u,ll v) { u=min(u,v); } ll delivery(int n,int k,int l,int a[]) { sort(a,a+n); ll res=l; selfmin(res,a[n-1]*2); selfmin(res,(l-a[0])*2); for(int i=0;i<n-1;i++) selfmin(res,a[i]*2+(l-a[i+1])*2); return res; } #ifdef SKY int main() { freopen("A.inp","r",stdin); freopen("A.out","w",stdout); // ios::sync_with_stdio(0); // cin.tie(NULL); // cout.tie(NULL); int n,k,l; cin>>n>>k>>l; int a[n]; for(int i=0;i<n;i++) cin>>a[i]; cout<<delivery(n,k,l,a); return 0; } #endif // SKY

Compilation message (stderr)

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:18:23: warning: unused parameter 'k' [-Wunused-parameter]
   18 | ll delivery(int n,int k,int l,int a[])
      |                   ~~~~^
#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...