UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#147257#1662. Gakkipan的星空haze1231100273ms5348kbC++573b2022-03-18 16:34:352022-03-18 16:34:35

answer

#include<bits/stdc++.h>

int a[100][200][200];

int main()
{
	int n, q;
	scanf("%d%d",&n,&q);
	for(int i = 1; i <= n; ++i){
		int x, y, c;
		scanf("%d%d%d", &x, &y, &c);
		a[c][x][y] ++;
	}
	for(int c = 0; c <= 50; ++c){
		for(int i = 1; i <= 100; ++i){
			for(int j = 1; j <= 100; ++j){
				a[c][i][j] += a[c][i][j-1] + a[c][i-1][j] - a[c][i-1][j-1];
			}
		}
	}
	while(q--){
		int x1, y1, x2, y2, c;
		scanf("%d%d%d%d%d",&x1, &y1, &x2, &y2, &c);
		printf("%d\n",a[c][x2][y2] - a[c][x1-1][y2] - a[c][x2][y1-1] + a[c][x1-1][y1-1]);
	}
	return 0;
}

详细

小提示:点击横条可展开更详细的信息

Test #1:

score: 10
Accepted
time: 32ms
memory: 5348kb

input:

45252 52368
43 9 45
88 11 39
81 75 7
19 23 6
46 41 16
3 84 35
49 84 20
10 5 16
19 88 6
80 3 1
83 69 ...

output:

86
5
31
26
14
7
3
129
108
91
25
19
82
5
37
35
37
70
49
69
78
28
25
7
167
100
63
52
220
76
22
104
137...

result:

ok 52368 lines

Test #2:

score: 10
Accepted
time: 30ms
memory: 5344kb

input:

61220 40887
20 40 30
89 2 22
74 97 12
7 25 40
18 61 9
22 40 15
29 39 47
44 8 36
17 47 3
28 56 46
61 ...

output:

163
37
21
8
133
153
43
14
83
208
99
88
19
70
204
106
18
121
17
120
81
169
5
35
35
123
60
97
98
53
24...

result:

ok 40887 lines

Test #3:

score: 10
Accepted
time: 34ms
memory: 5344kb

input:

44052 52274
80 56 43
82 10 4
81 32 39
30 2 1
90 10 23
71 3 49
89 5 1
37 87 44
14 23 9
56 79 42
83 92...

output:

95
155
71
22
74
101
96
182
8
7
45
13
26
32
145
83
16
23
155
25
34
45
9
23
122
21
68
9
58
6
119
16
50...

result:

ok 52274 lines

Test #4:

score: 10
Accepted
time: 30ms
memory: 5348kb

input:

47363 32156
55 20 43
2 71 37
59 46 12
60 44 29
1 14 30
95 15 14
47 49 20
70 81 28
56 7 10
39 6 7
28 ...

output:

21
140
91
21
25
66
19
33
83
169
70
44
22
34
49
47
190
44
121
165
117
122
23
24
89
122
13
133
41
12
5...

result:

ok 32156 lines

Test #5:

score: 10
Accepted
time: 40ms
memory: 5344kb

input:

78844 42705
25 36 24
9 40 42
27 84 21
46 85 21
31 12 40
100 92 39
48 51 49
18 21 19
95 93 13
44 64 5...

output:

9
298
50
188
49
123
47
6
3
6
49
62
281
34
331
12
334
36
247
163
34
138
193
46
151
48
225
67
71
3
213...

result:

ok 42705 lines

Test #6:

score: 10
Accepted
time: 0ms
memory: 5344kb

input:

6315 8
65 21 5
45 44 4
3 32 12
62 16 19
68 27 3
16 4 9
50 46 3
42 61 4
33 17 6
14 25 1
42 41 6
21 44...

output:

5
5
29
71
75
12
20
57

result:

ok 8 lines

Test #7:

score: 10
Accepted
time: 3ms
memory: 5348kb

input:

6638 8
70 52 4
17 19 18
59 70 7
2 24 15
15 58 10
16 14 7
54 53 6
55 32 18
12 50 9
12 69 3
36 37 18
4...

output:

1
61
72
20
37
51
3
6

result:

ok 8 lines

Test #8:

score: 10
Accepted
time: 43ms
memory: 5348kb

input:

48936 62912
70 79 33
3 14 32
96 76 41
65 88 49
46 47 21
52 46 36
96 27 47
41 24 21
35 11 41
70 85 44...

output:

22
12
177
16
24
43
14
14
31
47
49
114
39
138
70
107
59
154
4
179
186
42
34
33
37
61
31
218
11
36
173...

result:

ok 62912 lines

Test #9:

score: 10
Accepted
time: 59ms
memory: 5344kb

input:

92799 90432
58 50 20
22 25 1
100 90 34
86 75 4
57 38 1
18 18 39
85 47 8
97 53 23
25 59 45
79 28 39
1...

output:

106
28
27
338
337
22
74
27
30
60
110
185
58
13
99
40
107
35
204
200
122
5
53
74
206
16
394
2
294
223...

result:

ok 90432 lines

Test #10:

score: 10
Accepted
time: 2ms
memory: 5348kb

input:

74 8
20 54 12
33 13 26
89 17 21
67 71 42
11 57 24
23 79 31
34 96 41
41 22 4
74 49 18
98 8 38
15 79 2...

output:

0
0
0
0
0
0
0
0

result:

ok 8 lines