Submission #923741

# Submission time Handle Problem Language Result Execution time Memory
923741 2024-02-07T17:14:21 Z an22inkle Examination (JOI19_examination) C++17
0 / 100
3000 ms 4184 KB
#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 << "0ait\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 << "0bit\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 time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3024 ms 4184 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3024 ms 4184 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -