Submission #743158

# Submission time Handle Problem Language Result Execution time Memory
743158 2023-05-17T08:27:54 Z vjudge1 Lightning Rod (NOI18_lightningrod) C++17
4 / 100
2000 ms 139716 KB
#include<bits/stdc++.h>

using namespace std;

using ll = long long ;
using pii = pair<ll , ll> ;
using i3 = tuple<ll , ll , ll> ;

const int N = 2e5+5  ;
const int MOD = 1e9+7 ;

int n ;

struct Points {
    int x , y ;
    bool operator<(const Points &other) const {
        if(y != other.y)
            return y > other.y ;
        else return x > other.x ;
    }
};

vector<Points> point ;

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

    cin >> n ;
    for(int i=0;i<n;i++){
        int x , y ; cin >> x >> y ;
        point.push_back({x , y}) ;
    }

    sort(point.begin() , point.end());


    int idx = 0 , ans = 0 ;
    while(idx < n){
        //cout << "x = " << point[idx].x << " y = " << point[idx].y << "\n" ;
        ans++ ;
        int i = idx+1 ;
        while(abs(point[idx].x - point[i].x) <= point[idx].y - point[i].y){
            i++;
        }
        idx = i ;
    }

    cout << ans ;

}

# Verdict Execution time Memory Grader output
1 Correct 1845 ms 131952 KB Output is correct
2 Correct 1687 ms 139276 KB Output is correct
3 Correct 1629 ms 139716 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2057 ms 137116 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1845 ms 131952 KB Output is correct
2 Correct 1687 ms 139276 KB Output is correct
3 Correct 1629 ms 139716 KB Output is correct
4 Runtime error 1 ms 340 KB Execution killed with signal 11
5 Halted 0 ms 0 KB -