Submission #67746

#TimeUsernameProblemLanguageResultExecution timeMemory
67746MANcityBoxes with souvenirs (IOI15_boxes)C++14
0 / 100
2 ms376 KiB
#include<iostream> #include<cstdio> #include<fstream> #include<algorithm> #include<cmath> #include<map> #include<queue> #include<set> #include<stack> #include<string> #include<cstring> #include<vector> #include "boxes.h" using namespace std; #define for1(i,n) for(int i=1;i<=(int)n;i++) #define for0(i,n) for(int i=0;i<=(int)n;i++) #define forn(i,n) for(int i=n;i>=1;i--) #define fo(i,x,y) for(int i=x;i<=(int)y;i++) #define fr(i,x,y) for(int i=x;i>=(int)y;i--) #define pb push_back #define mp make_pair #define LL long long const LL Mod=1000*1000*1000+7; const int N=10000002; LL d1[N]; LL d2[N]; int P[N]; long long delivery(int n, int k, int l, int p[]) { for0(i,n-1) P[i+1]=p[i]; sort(P+1,P+n+1); for1(i,n) { d1[i]=d1[max(0,i-k)]+2*P[i]; } forn(i,n) { d2[i]=d2[min(n+1,i+k)]+2*(l-P[i]); } LL ans=1000*1000*1000*1000*1000*100; for0(i,n) ans=min(ans,d1[i]+d2[i+1]); return ans; }

Compilation message (stderr)

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:40:26: warning: integer overflow in expression [-Woverflow]
     LL ans=1000*1000*1000*1000*1000*100;
            ~~~~~~~~~~~~~~^~~~~
#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...