Submission #14046

#TimeUsernameProblemLanguageResultExecution timeMemory
14046paulsohn정전 (OJUZ10_blackout)C++98
100 / 100
51 ms1708 KiB
#include <cstdio> #include <algorithm> using namespace std; int N, X[160000]; long long L, a=-0xFFFFFFFF, b=-0xFFFFFFFFF, sum=0; int main() { int i,inp; scanf("%d%lld",&N,&L); for(i=0;i<N;++i) scanf("%d",X+i); sort(X,X+N); for(i=0;i<N;++i){ if(b<X[i]-L){ a=X[i]-L; b=X[i]+L; } else{ sum+=b-max(a,X[i]-L); a=b; b=X[i]+L; } } printf("%lld",sum); 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...