Submission #743186

# Submission time Handle Problem Language Result Execution time Memory
743186 2023-05-17T08:41:08 Z vjudge1 Lightning Rod (NOI18_lightningrod) C++17
40 / 100
2000 ms 136944 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 ;

map<pii , bool> vis ;

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 i = 0 , cnt = 0 , ans = 0 ;
    while(cnt < n && i < n){
        int curx = point[i].x , cury = point[i].y ;
        if(vis[pii(curx , cury)]){
            i++;
           continue ;
        }
        ans++;
        vis[pii(curx , cury)] = true ;
        for(auto [x , y] : point){
            if(abs(x - curx) > cury - y) continue ;
            if(vis[pii(x , y)]) continue ;
            vis[pii(x,y)] = true ;
            cnt++;
        }
        i++;
    }

    cout << ans ;

}

# Verdict Execution time Memory Grader output
1 Execution timed out 2074 ms 136944 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 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 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 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 0 ms 212 KB Output is correct
11 Correct 5 ms 340 KB Output is correct
12 Correct 4 ms 340 KB Output is correct
13 Correct 6 ms 424 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 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 0 ms 212 KB Output is correct
11 Correct 5 ms 340 KB Output is correct
12 Correct 4 ms 340 KB Output is correct
13 Correct 6 ms 424 KB Output is correct
14 Execution timed out 2060 ms 13280 KB Time limit exceeded
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2054 ms 132636 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2074 ms 136944 KB Time limit exceeded
2 Halted 0 ms 0 KB -