답안 #13975

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
13975 2015-04-24T17:18:47 Z gs14004 정전 (OJUZ10_blackout) C++14
100 / 100
286 ms 19956 KB
#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);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1212 KB Output is correct
2 Correct 0 ms 1212 KB Output is correct
3 Correct 0 ms 1212 KB Output is correct
4 Correct 0 ms 1212 KB Output is correct
5 Correct 0 ms 1212 KB Output is correct
6 Correct 0 ms 1212 KB Output is correct
7 Correct 0 ms 1212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1344 KB Output is correct
2 Correct 0 ms 1344 KB Output is correct
3 Correct 0 ms 1344 KB Output is correct
4 Correct 0 ms 1344 KB Output is correct
5 Correct 1 ms 1344 KB Output is correct
6 Correct 0 ms 1344 KB Output is correct
7 Correct 0 ms 1344 KB Output is correct
8 Correct 1 ms 1344 KB Output is correct
9 Correct 0 ms 1344 KB Output is correct
10 Correct 0 ms 1344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 125 ms 12828 KB Output is correct
2 Correct 72 ms 8604 KB Output is correct
3 Correct 214 ms 19164 KB Output is correct
4 Correct 6 ms 2400 KB Output is correct
5 Correct 133 ms 13620 KB Output is correct
6 Correct 205 ms 19956 KB Output is correct
7 Correct 221 ms 19824 KB Output is correct
8 Correct 122 ms 13620 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 145 ms 13356 KB Output is correct
2 Correct 257 ms 19956 KB Output is correct
3 Correct 144 ms 12828 KB Output is correct
4 Correct 136 ms 13620 KB Output is correct
5 Correct 286 ms 19956 KB Output is correct
6 Correct 119 ms 10848 KB Output is correct
7 Correct 75 ms 8604 KB Output is correct
8 Correct 216 ms 19956 KB Output is correct
9 Correct 225 ms 19956 KB Output is correct
10 Correct 0 ms 2400 KB Output is correct
11 Correct 236 ms 19956 KB Output is correct
12 Correct 235 ms 19956 KB Output is correct
13 Correct 139 ms 13620 KB Output is correct
14 Correct 250 ms 19956 KB Output is correct
15 Correct 148 ms 13620 KB Output is correct