Submission #1173591

#TimeUsernameProblemLanguageResultExecution timeMemory
1173591avighnaExamination (JOI19_examination)C++20
2 / 100
3094 ms3264 KiB
#include <bits/stdc++.h> // struct SegmentTree { // public: // std::vector<int> seg; // int n; // SegmentTree(int n) : n(n) { seg.resize(2 * n); } // void add(int idx, int del) { // for (seg[idx += n] += del; idx > 1; idx /= 2) { // seg[idx / 2] = seg[idx] + seg[idx ^ 1]; // } // } // int query(int l, int r) { // int ans = 0; // for (l += n, r += n + 1; l < r; l /= 2, r /= 2) { // if (l & 1) { // ans += seg[l++]; // } // if (r & 1) { // ans += seg[--r]; // } // } // return ans; // } // }; int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(nullptr); int n, q; std::cin >> n >> q; std::vector<std::pair<int, int>> a(n); for (auto &[s, t] : a) { std::cin >> s >> t; } struct Query { int x, y, z; int i; }; std::vector<Query> queries; for (int i = 0, x, y, z; i < q; ++i) { std::cin >> x >> y >> z; queries.push_back({x, y, z, i}); } for (auto &[x, y, z, i] : queries) { int ans = 0; for (auto &[a, b] : a) { ans += a >= x and b >= y and a + b >= z; } std::cout << ans << '\n'; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...