Submission #18909

#TimeUsernameProblemLanguageResultExecution timeMemory
18909chan492811정전 (OJUZ10_blackout)C++98
0 / 100
35 ms1084 KiB
#include <cstdio> #include <algorithm> using namespace std; int n,l,ep,sep; long long res; int main(){ int i,a,now; scanf("%d %d",&n,&l); ep=-21e8; sep=-21e8; for(i=0;i<n;i++){ scanf("%d",&a); if(a-l<=ep){ now=max(sep,a-l); res+=max(0,ep-now); sep=ep; } ep=a+l; } printf("%lld",res); 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...