Submission #14150

#TimeUsernameProblemLanguageResultExecution timeMemory
14150juchan1220정전 (OJUZ10_blackout)C++98
50 / 100
52 ms1668 KiB
#include <stdio.h> #include <algorithm> #define MIN -1000000001 using namespace std; int n,l,lamp[150001]; int main (void) { int i,cnt=0,prv=MIN; scanf("%d %d",&n,&l); for(i=0;i<n;i++){ scanf("%d",&lamp[i]); } sort(lamp,lamp+n); for(i=1;i<n;i++){ if(lamp[i-1]+l>max(prv,lamp[i]-l)){ cnt+=lamp[i-1]+l-max(prv,lamp[i]-l); prv=lamp[i-1]+l; } } printf("%d\n",cnt); 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...