编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#24381 #1004. D. 成立西安“全天候”量化科技有限公司 Accepted 100 249 ms 1528 K C++ 11 / 1.1 K JM233333 2020-04-25 11:32:09
显示原始代码
#include <iostream>
#include <cstdio>
#include <cstring>
#include <set>
#include <algorithm>

using namespace std;
typedef long long ll;

class Star {
public:
    int x, y, z;
    Star(int i, int j, int k) : x(i), y(j), z(k) {}
    Star() {}
    friend bool operator<(const Star& A, const Star& B) {
        if (A.x != B.x) {
            return (A.x < B.x);
        } else {
            return (A.z > B.z);
        }
    }
};

const int MAX = 1e5 + 5;
Star stars[MAX];
multiset<int> ms;

int main() {
    // freopen("test.txt", "r", stdin);
    int T;
    int n;
    scanf("%d", &T);
    while (T--) {
        // 初始化
        ms.clear();
        // 输入
        scanf("%d", &n);
        for (int i = 1; i <= n; i++) {
            scanf("%d %d %d", &stars[i].x, &stars[i].y, &stars[i].z);
        }
        // 排序
        sort(stars + 1, stars + 1 + n);
        // 求解
        int res = 0;
        for (int i = 1; i <= n; i++) {
            if (stars[i].z == 1) {
                auto it = ms.lower_bound(stars[i].y);
                if (it != ms.begin()) {
                    ms.erase(prev(it));
                    res++;
                }
            } else {
                ms.insert(stars[i].y);
            }
        }
        // 输出
        printf("%d\n", res);
    }
    return 0;
}
子任务 #1
Accepted
得分:100
测试点 #1
Accepted
得分:100
用时:3 ms
内存:352 KiB

输入文件(1.in

2
2
1 1 0
2 2 1
2
1 1 1
2 2 1

答案文件(1.out

1
0

用户输出

1
0

系统信息

Exited with return code 0
测试点 #2
Accepted
得分:100
用时:3 ms
内存:264 KiB

输入文件(2.in

5
1
2 0 0
2
2 2 1
0 5 0
1
0 0 0
3
4 0 0
3 5 0
3 3 0
3
1 1 1
5 5 1
5 5 0

答案文件(2.out

0
0
0
0
0

用户输出

0
0
0
0
0

系统信息

Exited with return code 0
测试点 #3
Accepted
得分:100
用时:3 ms
内存:284 KiB

输入文件(3.in

5
5
0 1 0
3 2 1
4 5 0
1 4 0
2 2 1
1
0 3 0
3
0 1 0
1 5 0
4 2 1
1
2 0 1
3
1 0 1
4 3 1
<9 bytes omitted>

答案文件(3.out

1
0
1
0
0

用户输出

1
0
1
0
0

系统信息

Exited with return code 0
测试点 #4
Accepted
得分:100
用时:3 ms
内存:236 KiB

输入文件(4.in

5
4
5 1 0
2 0 0
0 5 1
4 0 0
1
2 3 1
4
0 0 0
4 4 1
0 5 1
0 3 1
5
5 5 1
3 5 1
0 0 0
2
<51 bytes omitted>

答案文件(4.out

0
0
1
2
1

用户输出

0
0
1
2
1

系统信息

Exited with return code 0
测试点 #5
Accepted
得分:100
用时:2 ms
内存:348 KiB

输入文件(5.in

5
3
4 3 0
2 1 0
4 3 0
5
1 3 0
4 5 1
4 3 0
2 0 0
0 5 0
5
4 2 0
4 2 1
1 2 1
0 2 1
4 0 
<44 bytes omitted>

答案文件(5.out

0
1
0
0
1

用户输出

0
1
0
0
1

系统信息

Exited with return code 0
测试点 #6
Accepted
得分:100
用时:3 ms
内存:356 KiB

输入文件(6.in

5
8
18 19 1
7 10 1
10 2 0
15 16 0
14 10 0
3 10 0
3 0 0
13 20 1
8
20 1 0
20 18 1
5 19 0
<318 bytes omitted>

答案文件(6.out

3
0
3
2
0

用户输出

3
0
3
2
0

系统信息

Exited with return code 0
测试点 #7
Accepted
得分:100
用时:3 ms
内存:356 KiB

输入文件(7.in

5
13
2 13 1
9 9 1
10 18 0
10 3 0
11 19 1
15 7 0
1 11 1
9 20 1
12 19 0
12 0 1
0 11 0
17 
<255 bytes omitted>

答案文件(7.out

4
2
4
0
0

用户输出

4
2
4
0
0

系统信息

Exited with return code 0
测试点 #8
Accepted
得分:100
用时:3 ms
内存:240 KiB

输入文件(8.in

5
20
9 16 1
2 6 0
8 16 1
1 15 1
11 1 0
4 13 1
8 8 1
5 9 0
20 13 1
10 19 1
9 9 0
6 7 1

<509 bytes omitted>

答案文件(8.out

5
1
3
3
3

用户输出

5
1
3
3
3

系统信息

Exited with return code 0
测试点 #9
Accepted
得分:100
用时:3 ms
内存:356 KiB

输入文件(9.in

5
4
20 12 1
7 19 1
20 9 1
20 12 1
9
9 8 1
10 6 1
19 1 1
20 3 0
9 1 0
18 17 0
13 0 0
16
<321 bytes omitted>

答案文件(9.out

0
2
2
1
3

用户输出

0
2
2
1
3

系统信息

Exited with return code 0
测试点 #10
Accepted
得分:100
用时:3 ms
内存:280 KiB

输入文件(10.in

5
14
18 6 0
9 20 1
13 19 0
5 8 1
11 13 0
14 14 0
2 15 1
11 7 1
17 2 1
9 13 1
9 0 1
7 4 
<262 bytes omitted>

答案文件(10.out

2
1
1
1
0

用户输出

2
1
1
1
0

系统信息

Exited with return code 0
测试点 #11
Accepted
得分:100
用时:4 ms
内存:280 KiB

输入文件(11.in

5
500
6 21 0
34 19 1
20 16 0
8 39 1
34 28 1
29 28 1
24 0 0
49 7 0
31 29 0
8 0 0
28 33 0
<33156 bytes omitted>

答案文件(11.out

199
448
234
376
392

用户输出

199
448
234
376
392

系统信息

Exited with return code 0
测试点 #12
Accepted
得分:100
用时:3 ms
内存:348 KiB

输入文件(12.in

5
99
39 2 1
31 20 0
23 42 1
14 20 0
11 6 0
35 17 1
46 46 1
31 12 1
21 20 1
19 26 1
34 31
<23942 bytes omitted>

答案文件(12.out

37
405
253
230
268

用户输出

37
405
253
230
268

系统信息

Exited with return code 0
测试点 #13
Accepted
得分:100
用时:3 ms
内存:308 KiB

输入文件(13.in

5
265
251 3009 1
250 2014 1
260 1683 1
238 3340 0
269 7459 1
275 1090 0
235 1099 0
253 7181
<15743 bytes omitted>

答案文件(13.out

113
45
47
25
311

用户输出

113
45
47
25
311

系统信息

Exited with return code 0
测试点 #14
Accepted
得分:100
用时:3 ms
内存:352 KiB

输入文件(14.in

5
779
1 2 0
3 2 1
2 3 1
2 3 0
2 2 1
1 1 0
2 1 0
2 2 0
2 1 0
3 2 0
2 1 1
1 1 0
1 2 1
2
<15230 bytes omitted>

答案文件(14.out

164
40
63
98
70

用户输出

164
40
63
98
70

系统信息

Exited with return code 0
测试点 #15
Accepted
得分:100
用时:3 ms
内存:364 KiB

输入文件(15.in

5
775
1343 1690 1
1336 1667 1
1337 1680 1
1334 1689 1
1340 1673 1
1342 1666 1
1335 1685 0
1
<41840 bytes omitted>

答案文件(15.out

331
203
134
358
286

用户输出

331
203
134
358
286

系统信息

Exited with return code 0
测试点 #16
Accepted
得分:100
用时:32 ms
内存:1212 KiB

输入文件(16.in

1
76883
494039077 497063733 1
991790472 699599226 1
856388129 516813283 0
404603544 968369775 1
<1751102 bytes omitted>

答案文件(16.out

37829

用户输出

37829

系统信息

Exited with return code 0
测试点 #17
Accepted
得分:100
用时:6 ms
内存:360 KiB

输入文件(17.in

1
8847
671644885 13604453 1
384481136 454599471 0
67657591 420079234 1
160390864 992023037 0
7
<201369 bytes omitted>

答案文件(17.out

4257

用户输出

4257

系统信息

Exited with return code 0
测试点 #18
Accepted
得分:100
用时:39 ms
内存:1468 KiB

输入文件(18.in

1
100000
569980851 442743025 1
97240074 590606533 1
155640720 410869960 1
280099927 120367499 1
<2277533 bytes omitted>

答案文件(18.out

49344

用户输出

49344

系统信息

Exited with return code 0
测试点 #19
Accepted
得分:100
用时:28 ms
内存:1296 KiB

输入文件(19.in

3
47670
1 1 1
3 3 0
2 1 0
3 1 0
1 2 1
2 1 0
1 3 0
1 1 0
3 1 1
2 3 0
1 2 0
1 1 1
1 1 1
<821024 bytes omitted>

答案文件(19.out

10612
10791
4472

用户输出

10612
10791
4472

系统信息

Exited with return code 0
测试点 #20
Accepted
得分:100
用时:99 ms
内存:1528 KiB

输入文件(20.in

3
100000
239293 4902203 0
239386 4902216 1
239310 4902159 1
239186 4902254 0
239250 4902239 1
<5399927 bytes omitted>

答案文件(20.out

49096
48722
48859

用户输出

49096
48722
48859

系统信息

Exited with return code 0