Submission #970518

# Submission time Handle Problem Language Result Execution time Memory
970518 2024-04-26T16:20:19 Z NoMercy Lightning Rod (NOI18_lightningrod) C++14
7 / 100
2000 ms 41848 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> fi , array<int , 2> se) -> 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};
        if (st.size() == 0) {
            st.push(tmp);
            continue;
        }
        if (check(tmp , st.top()) == true) {
            continue;
        }
        while (st.size() > 0 && check(st.top() , tmp) == true) {
            st.pop();
        }
        st.push({x , y});
    }
    cout << (int)st.size() << "\n";
}
 
 
int32_t main () {
 
     /////   file
    
 
    int t = 1;
    // cin >> t;
 
    while (t --) {
        test_case();
    }
 
    return 0;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 2049 ms 41848 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Incorrect 0 ms 344 KB Output isn't correct
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Incorrect 0 ms 344 KB Output isn't correct
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Incorrect 0 ms 344 KB Output isn't correct
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2033 ms 29400 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2049 ms 41848 KB Time limit exceeded
2 Halted 0 ms 0 KB -