Submission #772956

# Submission time Handle Problem Language Result Execution time Memory
772956 2023-07-04T13:30:05 Z Blagoj Examination (JOI19_examination) C++17
2 / 100
3000 ms 3080 KB
#include <bits/stdc++.h>

#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 42
#endif

#pragma GCC optimize("Ofast,unroll-loops")

using namespace std;

#define endl '\n'
#define ll long long
#define all(x) x.begin(), x.end()

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, q;
    cin >> n >> q;
    vector<pair<ll, ll>> v(n);
    vector<ll> val(n);
    for (int i = 0; i < n; i++) {
        cin >> v[i].first >> v[i].second;
    }
    sort(all(v));
    for (int i = 0; i < n; i++) val[i] = v[i].first;
    while (q--) {
        ll x, y, z;
        cin >> x >> y >> z;
        if (x > val[n - 1]) {
            cout << 0 << endl;
            continue;
        }
        int lower = lower_bound(all(val), x) - val.begin(), ans = 0;
        for (int i = lower; i < n; i++) ans += (v[i].second >= y && v[i].first + v[i].second >= z);
        cout << ans << endl;
    }
}
# 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 212 KB Output is correct
5 Correct 0 ms 320 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 8 ms 468 KB Output is correct
8 Correct 9 ms 452 KB Output is correct
9 Correct 9 ms 468 KB Output is correct
10 Correct 8 ms 500 KB Output is correct
11 Correct 7 ms 504 KB Output is correct
12 Correct 7 ms 340 KB Output is correct
13 Correct 11 ms 508 KB Output is correct
14 Correct 8 ms 516 KB Output is correct
15 Correct 9 ms 504 KB Output is correct
16 Correct 5 ms 468 KB Output is correct
17 Correct 5 ms 488 KB Output is correct
18 Correct 3 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 3060 ms 3080 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3060 ms 3080 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 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 320 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 8 ms 468 KB Output is correct
8 Correct 9 ms 452 KB Output is correct
9 Correct 9 ms 468 KB Output is correct
10 Correct 8 ms 500 KB Output is correct
11 Correct 7 ms 504 KB Output is correct
12 Correct 7 ms 340 KB Output is correct
13 Correct 11 ms 508 KB Output is correct
14 Correct 8 ms 516 KB Output is correct
15 Correct 9 ms 504 KB Output is correct
16 Correct 5 ms 468 KB Output is correct
17 Correct 5 ms 488 KB Output is correct
18 Correct 3 ms 340 KB Output is correct
19 Execution timed out 3060 ms 3080 KB Time limit exceeded
20 Halted 0 ms 0 KB -