답안 #541689

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
541689 2022-03-24T07:46:55 Z cristi_a Lightning Rod (NOI18_lightningrod) C++17
100 / 100
1740 ms 227792 KB
#include <bits/stdc++.h>
using namespace std;

bool cover(pair<int,int> a, pair<int,int> b) {
    return abs(a.first-b.first) <= a.second - b.second;
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    int n; cin >> n;
    vector<pair<int,int>> v(n);
    for(int i=0; i<n; i++) cin >> v[i].first >> v[i].second;
    stack<pair<int,int>> st;
    for(int i=0; i<n; i++) {
        while(!st.empty() and cover(v[i], st.top())) st.pop();
        if(st.empty()) st.emplace(v[i]);
        else if(!cover(st.top(), v[i])) st.emplace(v[i]);
    }
    cout << st.size();
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1326 ms 163736 KB Output is correct
2 Correct 1327 ms 162284 KB Output is correct
3 Correct 1300 ms 152544 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 320 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 320 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 316 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 320 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 316 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 320 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 316 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 38 ms 5324 KB Output is correct
15 Correct 41 ms 5144 KB Output is correct
16 Correct 40 ms 5188 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1375 ms 130512 KB Output is correct
2 Correct 1346 ms 130268 KB Output is correct
3 Correct 1322 ms 126976 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1326 ms 163736 KB Output is correct
2 Correct 1327 ms 162284 KB Output is correct
3 Correct 1300 ms 152544 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 320 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 0 ms 316 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 38 ms 5324 KB Output is correct
18 Correct 41 ms 5144 KB Output is correct
19 Correct 40 ms 5188 KB Output is correct
20 Correct 1375 ms 130512 KB Output is correct
21 Correct 1346 ms 130268 KB Output is correct
22 Correct 1322 ms 126976 KB Output is correct
23 Correct 1634 ms 72540 KB Output is correct
24 Correct 1740 ms 227792 KB Output is correct
25 Correct 1630 ms 210180 KB Output is correct