Submission #772956

#TimeUsernameProblemLanguageResultExecution timeMemory
772956BlagojExamination (JOI19_examination)C++17
2 / 100
3060 ms3080 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...