Submission #183930

# Submission time Handle Problem Language Result Execution time Memory
183930 2020-01-10T08:18:57 Z duttaditya18 Lightning Rod (NOI18_lightningrod) C++17
66 / 100
2000 ms 252856 KB
#include <bits/stdc++.h>

using namespace std;

#define fi first
#define se second

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

    int n; cin >> n;

    // x, y
    pair<int, int> p[n + 1];

    for(int i = 1; i <= n; i++)
        cin >> p[i].fi >> p[i].se;

    int suf[n + 2] = {};
    int prf[n + 2] = {};

    prf[0] = INT_MIN;
    prf[n + 1] = INT_MIN;

    suf[0] = INT_MAX;
    suf[n + 1] = INT_MAX;

    for(int i = 1; i <= n; i++)
        prf[i] = max(prf[i - 1], p[i].fi + p[i].se);


    for(int i = n; i >= 1; i--)
        suf[i] = min(suf[i + 1], p[i].fi - p[i].se);


    int ans = n;
    for(int i = 1; i <= n; i++)
        ans -= ((p[i].fi + p[i].se <= prf[i - 1]) || (p[i].fi - p[i].se >= suf[i + 1]));
    cout << ans << endl;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 2064 ms 183628 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 3 ms 376 KB Output is correct
5 Correct 4 ms 376 KB Output is correct
6 Correct 2 ms 380 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 3 ms 376 KB Output is correct
5 Correct 4 ms 376 KB Output is correct
6 Correct 2 ms 380 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 380 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 3 ms 376 KB Output is correct
5 Correct 4 ms 376 KB Output is correct
6 Correct 2 ms 380 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 380 KB Output is correct
11 Correct 3 ms 376 KB Output is correct
12 Correct 3 ms 376 KB Output is correct
13 Correct 3 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 3 ms 376 KB Output is correct
5 Correct 4 ms 376 KB Output is correct
6 Correct 2 ms 380 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 380 KB Output is correct
11 Correct 3 ms 376 KB Output is correct
12 Correct 3 ms 376 KB Output is correct
13 Correct 3 ms 376 KB Output is correct
14 Correct 50 ms 6868 KB Output is correct
15 Correct 52 ms 6684 KB Output is correct
16 Correct 51 ms 6008 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 2032 ms 252856 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2064 ms 183628 KB Time limit exceeded
2 Halted 0 ms 0 KB -