Submission #550835

# Submission time Handle Problem Language Result Execution time Memory
550835 2022-04-19T10:05:25 Z AKiko Lightning Rod (NOI18_lightningrod) C++14
11 / 100
1643 ms 79276 KB
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define ss second
#define ff first
#define pb push_back
#define pii pair<int, int>
#define INF INT_MAX
using namespace std;
void debug_out() { cerr << endl; }
template<typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << ' ' << H; debug_out(T...); }
#ifdef AKIKO_DEBUG
#define debug(...) cerr << "\033[1;31m(" << #__VA_ARGS__ << "):\033[0m", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

#define FAST ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

const ll MOD = 1e9 + 7;








int main() {
    FAST
    int n, ind = 0;
    cin >> n;
    vector<pii> a(n);
    for(int i = 0; i < n; i++) {
        cin >> a[i].ff >> a[i].ss;
        if(a[i].ss > a[ind].ss) {
            ind = i;
        }
    }
    int ans = 1, l = ind, r = ind, cur = ind;
    while(l >= 0) {
        if(a[cur].ss - a[l].ss < a[cur].ff - a[l].ff) {
            cur = l;
            ans++;
        }
        l--;
    }
    cur = ind;
    while(r < n) {
        if(a[cur].ss - a[r].ss < a[r].ff - a[cur].ff) {
            cur = r;
            ans++;
        }
        r++;
    }
    cout << ans << "\n";
    

    return 0;
}

/* stuff you should look for
    * int overflow, array bounds
    * special cases (n=1?)
    * do smth instead of nothing and stay organized
    * WRITE STUFF DOWN
    * DON'T GET STUCK ON ONE APPROACH
*/
# Verdict Execution time Memory Grader output
1 Correct 1643 ms 77108 KB Output is correct
2 Correct 1501 ms 77704 KB Output is correct
3 Correct 1432 ms 75576 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 320 KB Output is correct
5 Correct 1 ms 320 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 224 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 320 KB Output is correct
5 Correct 1 ms 320 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 224 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Incorrect 1 ms 320 KB Output isn't correct
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 320 KB Output is correct
5 Correct 1 ms 320 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 224 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Incorrect 1 ms 320 KB Output isn't correct
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 320 KB Output is correct
5 Correct 1 ms 320 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 224 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Incorrect 1 ms 320 KB Output isn't correct
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1401 ms 79276 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1643 ms 77108 KB Output is correct
2 Correct 1501 ms 77704 KB Output is correct
3 Correct 1432 ms 75576 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 320 KB Output is correct
8 Correct 1 ms 320 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 224 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Incorrect 1 ms 320 KB Output isn't correct
13 Halted 0 ms 0 KB -