제출 #923742

#제출 시각아이디문제언어결과실행 시간메모리
923742an22inkleExamination (JOI19_examination)C++17
2 / 100
3010 ms2648 KiB
#include <bits/stdc++.h> using ll = long long; using ull = unsigned long long; using pair = std::array<int, 2>; using pairll = std::array<ll, 2>; using tri = std::array<int, 3>; using trill = std::array<ll, 3>; constexpr long long MOD = 998244353; int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int N, Q; std::cin >> N >> Q; std::vector<trill> v(N); for (int i = 0; i < N; i++) { ll a, b; std::cin >> a >> b; trill score = {a, b, a + b}; v[i] = score; } while (Q--) { std::sort(v.begin(), v.end(), [&](trill a, trill b) {return a[0] < b[0];}); ll s, t, u; std::cin >> s >> t >> u; trill check = {s, 0, 0}; auto ait = std::upper_bound(v.begin(), v.end(), check, [&](trill value, trill element){return element[0] >= value[0];}); if (ait == v.end()) { std::cout << "0\n"; continue; } std::sort(v.begin() + (ait - v.begin()), v.end(), [&](trill a, trill b) {return a[1] < b[1];}); check = {0, t, 0}; auto bit = std::upper_bound(v.begin() + (ait - v.begin()), v.end(), check, [&](trill value, trill element){return element[1] >= value[1];}); if (bit == v.end()) { std::cout << "0\n"; continue; } std::sort(v.begin() + (bit - v.begin()), v.end(), [&](trill a, trill b) {return a[2] < b[2];}); check = {0, 0, u}; auto toit = std::upper_bound(v.begin() + (bit - v.begin()), v.end(), check, [&](trill value, trill element) {return element[2] >= value[2];}); std::cout << (v.end() - toit) << '\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...