Submission #824434

# Submission time Handle Problem Language Result Execution time Memory
824434 2023-08-14T06:14:39 Z christinelynn Lightning Rod (NOI18_lightningrod) C++17
40 / 100
2000 ms 262144 KB
# include <bits/stdc++.h>
# define int long long
# define vi vector<int>
# define pb push_back
# define pii pair<int, int>
# define fi first
# define se second
# define endl '\n'
# define jess ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

using namespace std;

int n;
set<pii> s;

void solve() {
    cin >> n;
    bool ok=1;
    for(int i=1; i<=n; i++) {
        int x, y;
        cin >> x >> y;
        if(y!=1) ok=0;
        s.insert({y, x});
    }
    if(ok) {
        cout << n << endl;
        return;
    }
    int ans=0;
    while(!s.empty()) {
        pii cur=*s.rbegin();
        ans++;
        vector<pii> v;
        for(pii i : s) {
            if(abs(i.se-cur.se)<=(cur.fi-i.fi)) {
                v.pb(i);
            }
        }
        for(pii i : v) s.erase(i);
    }
    cout << ans << endl;
}
 
signed main() {
    solve();
}
# Verdict Execution time Memory Grader output
1 Execution timed out 2059 ms 227700 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 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 1 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 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 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 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 2 ms 468 KB Output is correct
12 Correct 4 ms 340 KB Output is correct
13 Correct 12 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 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 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 2 ms 468 KB Output is correct
12 Correct 4 ms 340 KB Output is correct
13 Correct 12 ms 340 KB Output is correct
14 Correct 209 ms 16028 KB Output is correct
15 Correct 525 ms 12556 KB Output is correct
16 Execution timed out 2071 ms 11744 KB Time limit exceeded
17 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1960 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2059 ms 227700 KB Time limit exceeded
2 Halted 0 ms 0 KB -