답안 #970516

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
970516 2024-04-26T16:17:59 Z NoMercy Lightning Rod (NOI18_lightningrod) C++14
0 / 100
2000 ms 43904 KB
#include <bits/stdc++.h>
using namespace std;
 
    
int TIME = clock();
 
#define file \
            freopen("in.txt" , "r" , stdin); \
            freopen("out.txt" , "w" , stdout);
 
 
void test_case () {
    int n;
    cin >> n;
    stack <array <int , 2>> st;
    auto check = [&](array<int , 2> se , array<int , 2> fi) -> bool {
        return (abs(fi[0] - se[0]) <= fi[1] - se[1]);
    };
    for (int i = 0;i < n;i ++) {
        int x , y;
        cin >> x >> y;
        array<int , 2> tmp = {x , y};
        while (st.size() > 0 && check(st.top() , tmp) == true) {
            st.pop();
        }
        if (st.size() == 0 || check(st.top() , tmp) == false) {
            st.push({x , y});
        }
    }
    cout << (int)st.size() << "\n";
}
 
 
int32_t main () {
 
     /////   file
    
 
    int t = 1;
    // cin >> t;
 
    while (t --) {
        test_case();
    }
 
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2047 ms 43904 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 1 ms 436 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 1 ms 436 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 1 ms 436 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 1 ms 436 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2028 ms 36672 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2047 ms 43904 KB Time limit exceeded
2 Halted 0 ms 0 KB -