Submission #169232

# Submission time Handle Problem Language Result Execution time Memory
169232 2019-12-19T07:41:21 Z aggu_01000101 Lightning Rod (NOI18_lightningrod) C++14
66 / 100
2000 ms 153292 KB
    #include <iostream>
    #include <algorithm>
    #include <cmath>
    #include <unordered_map>
    #include <fstream>
    #include <stack>
    #include <vector>
    #include <set>
    #include <queue>
    #include <cstdlib>
    #include <cstring>
    #include <map>
    #define int long long
    using namespace std;
    int32_t main(){
        ios_base::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
        int n;
        cin>>n;
        stack<pair<int, int>> st;
        for(int i =0 ;i<n;i++){
            int x, y;
            cin>>x>>y;
            bool toadd = true;
            bool cont = true;
            while(st.size() && cont){
                if(abs(x - st.top().first)<=(st.top().second - y)) toadd = cont = false;
                else if(abs(x - st.top().first)<=(y-st.top().second)) st.pop();
                else cont = false;
            }
            if(toadd) st.push(make_pair(x, y));
        }
        cout<<st.size()<<endl;
    }
# Verdict Execution time Memory Grader output
1 Execution timed out 2059 ms 153292 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 252 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 252 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 252 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 252 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 53 ms 2048 KB Output is correct
15 Correct 52 ms 504 KB Output is correct
16 Correct 50 ms 1844 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 2043 ms 99004 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2059 ms 153292 KB Time limit exceeded
2 Halted 0 ms 0 KB -