Submission #13975

#TimeUsernameProblemLanguageResultExecution timeMemory
13975gs14004정전 (OJUZ10_blackout)C++14
100 / 100
286 ms19956 KiB
#include <cstdio> #include <map> using namespace std; map<long long,int> mp; int main(){ int n,l; scanf("%d %d",&n,&l); for (int i=0; i<n; i++) { int t; scanf("%d",&t); mp[t-l]++; mp[t+l]--; } int hi = 0; long long ret = 0; auto it = mp.begin(); for (auto &i : mp){ hi += i.second; it++; if(hi > 1 && it != mp.end()) ret += it->first - i.first; } printf("%lld",ret); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...