QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#323181#62. Examinationan22inkle0 43ms15776kbC++172.1kb2024-02-08 19:30:112024-02-08 19:30:11

Judging History

你现在查看的是最新测评结果

  • [2024-02-08 19:30:11]
  • 评测
  • 测评结果:0
  • 用时:43ms
  • 内存:15776kb
  • [2024-02-08 19:30:11]
  • 提交

answer

#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<tri> points;
    std::map<int, std::map<int, int>> lol;
    std::vector<int> col, row;

    for (int i = 0; i < N; i++) {
    	int a, b;
    	std::cin >> a >> b;
    	tri score = {a, b, 1};

    	points.push_back(score);
    	row.push_back(a);
    	col.push_back(b);
    }


    std::sort(points.begin(), points.end(), [](tri a, tri b) {
    	if (a[0] != b[0]) {
    		return a[0] > b[0];
    	} else {
    		return a[1] > b[1];
    	}
    });

    // unique
    for (int i = points.size() - 1; i >= 0; i--) {
    	if (points[i][0] == points[i+1][0] && points[i][1] == points[i+1][1]) {
    		points[i][2] += points[i+1][2];
    	}
    }
    points.erase(std::unique(points.begin(), points.end(), [](tri a, tri b){return a[0] == b[0] && a[1] == b[1];}), points.end());


    for (auto point : points) {
    	// std::cout << point[0] << ' ' << point[1] << ' ' << point[2] << '\n';
    }

    for (int i = 1; i < points.size(); i++) {
    	points[i][2] += points[i-1][2];
    }

    for (auto point : points) {
    	// std::cout << point[0] << ' ' << point[1] << ' ' << point[2] << '\n';
    	lol[point[0]][point[1]] = point[2];
    }

    while (Q--) {
    	int x, y ,z;
    	std::cin >> x >> y >> z;

    	auto nrow = std::upper_bound(row.begin(), row.end(), x, [](int val, int el) {return el >= val;});

    	if (nrow == row.end()) {
    		std::cout << "0\n";
    		continue;
    	}

    	auto ncol = std::upper_bound(col.begin(), col.end(), *nrow, [](int val, int el) {return el >= val;});
    	if (ncol == col.end()) {
    		std::cout << "0\n";
    		continue;
    	}
    	
        // std::cout << *nrow << ' ' << *ncol << '\n';
    	std::cout << lol[*nrow - 1][*ncol] << '\n';

    }
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3536kb

input:

10 10
28 2
78 81
39 79
61 31
36 99
90 5
20 55
91 4
48 19
80 7
52 43 78
64 65 171
34 68 124
37 80 161
53 19 123
49 58 109
95 46 30
45 48 60
47 13 54
64 30 144

output:

0
0
0
0
0
0
0
0
0
0

result:

wrong answer 1st lines differ - expected: '1', found: '0'

Subtask #2:

score: 0
Wrong Answer

Test #19:

score: 0
Wrong Answer
time: 43ms
memory: 15776kb

input:

100000 100000
26753 11234
32815 62591
34318 93262
77179 57605
88208 33327
48449 99060
42403 58561
85715 7001
2418 90938
77409 6957
546 83283
53957 8374
49470 1483
65866 64950
4269 8745
19041 85833
22344 90706
92926 35603
54697 75311
72601 66401
77598 8193
3751 54202
32710 5877
23835 38264
34381 3338...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

wrong answer 1st lines differ - expected: '3392', found: '0'

Subtask #3:

score: 0
Skipped

Dependency #2:

0%

Subtask #4:

score: 0
Skipped

Dependency #1:

0%