# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
13975 | gs14004 | 정전 (OJUZ10_blackout) | C++14 | 286 ms | 19956 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |