답안 #824435

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
824435 2023-08-14T06:17:52 Z kebine Lightning Rod (NOI18_lightningrod) C++17
40 / 100
2000 ms 92004 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, x[10000006], y[10000005];
set<pii> s;

void solve() {
    cin >> n;
    bool ok=1;
    for(int i=1; i<=n; i++) {
        cin >> x[i] >> y[i];
        if(y[i]!=1) ok=0;
    }
    if(ok) {
        cout << n << endl;
        return;
    }
    for(int i=1; i<=n; i++) {
        s.insert({y[i], x[i]});
    }
    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();
}
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2056 ms 82184 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 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 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
# 결과 실행 시간 메모리 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 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 3 ms 340 KB Output is correct
13 Correct 11 ms 472 KB Output is correct
# 결과 실행 시간 메모리 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 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 3 ms 340 KB Output is correct
13 Correct 11 ms 472 KB Output is correct
14 Correct 204 ms 18932 KB Output is correct
15 Correct 619 ms 15608 KB Output is correct
16 Execution timed out 2050 ms 14540 KB Time limit exceeded
17 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2036 ms 92004 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2056 ms 82184 KB Time limit exceeded
2 Halted 0 ms 0 KB -