Submission #14127

#TimeUsernameProblemLanguageResultExecution timeMemory
14127minchurl정전 (OJUZ10_blackout)C++98
30 / 100
51 ms2256 KiB
#include<stdio.h> #include<algorithm> using namespace std; int n,l,b[150005],t[150005],dap; void make_dap(){ //int ; } void f(int cnt){ if(cnt==n){ make_dap(); return ; } t[cnt]=0; f(cnt+1); t[cnt]=1; f(cnt+1); } int main(){ int i; scanf("%d %d",&n,&l); for(i=0;i<n;i++) scanf("%d",&b[i]); sort(b,b+n); /*if(n<=15){ f(0); printf("%d\n",dap); return 0; }*/ for(i=1;i<n;i++){ if(b[i-1]+l<=b[i]-l) continue; dap+=b[i-1]-b[i]+l*2; } printf("%d\n",dap); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...