Submission #743160

# Submission time Handle Problem Language Result Execution time Memory
743160 2023-05-17T08:28:13 Z vjudge1 Lightning Rod (NOI18_lightningrod) C++17
40 / 100
2000 ms 205192 KB
#include <bits/stdc++.h>
#define x first
#define y second
using namespace std;
const int N = 1e7 + 1;
pair<int,int> arr[N];
map<pair<int,int>, bool> mp;
bool comp(const pair<int,int> &a, const pair<int,int> &b) {
    if (a.second != b.second) return a.second > b.second;
    return a.first > b.first;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int n,ans=0; cin >> n;
    for(int i=1;i<=n;i++) cin >> arr[i].x >> arr[i].y;
    if (n>2000) {
        set<int> s;
        for(int i=1;i<=n;i++) {
            s.insert(arr[i].x);
        }
        cout << s.size();
        return 0;
    }
    
    sort(arr+1, arr+1+n, comp);
    for(int i=1;i<=n;i++) {
        bool check = false;
        for(auto [a,b]:mp) {
            if (abs(arr[i].x - a.x) <= abs(arr[i].y - a.y)) check = true;
        }
        if (!check) {
            ans++;
            mp[arr[i]] = true;
        }
    }
    cout << ans;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 2084 ms 205192 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 1 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 1 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 1 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 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 224 KB Output is correct
10 Correct 1 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 1 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 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 224 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 5 ms 340 KB Output is correct
13 Correct 19 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 1 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 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 224 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 5 ms 340 KB Output is correct
13 Correct 19 ms 424 KB Output is correct
14 Incorrect 72 ms 10316 KB Output isn't correct
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2091 ms 204896 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2084 ms 205192 KB Time limit exceeded
2 Halted 0 ms 0 KB -