QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#692203#9303. Message BombLuCiiiD#TL 309ms45492kbC++14695b2024-10-31 14:03:472024-10-31 14:03:49

Judging History

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

  • [2024-10-31 14:03:49]
  • 评测
  • 测评结果:TL
  • 用时:309ms
  • 内存:45492kb
  • [2024-10-31 14:03:47]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define MAX 200005
int N,M,S,t,x,y,cnt[MAX],lazy[MAX];
unordered_set<int>ChatGroup[MAX];
inline void updateCNT(int Group)
{
	if(!lazy[Group])
		return;
	for(auto stu:ChatGroup[Group])
		cnt[stu]+=lazy[Group];
	lazy[Group]=0;
	return;
}
signed main()
{
	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	cin>>N>>M>>S;
	while(S--)
	{
		cin>>t>>x>>y;
		if(t==1)
			updateCNT(y),ChatGroup[y].insert(x);
		else if(t==2)
			updateCNT(y),ChatGroup[y].erase(ChatGroup[y].find(x));
		else if(t==3)
			lazy[y]++,cnt[x]--;
	}
	for(int i=1;i<=N;i++)
		updateCNT(i);
	for(int i=1;i<=M;i++)
		cout<<cnt[i]<<endl;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 15528kb

input:

3 3 10
1 3 2
1 3 1
1 1 2
1 2 1
3 1 2
2 3 1
3 3 2
3 2 1
3 3 2
3 2 1

output:

2
0
1

result:

ok 3 lines

Test #2:

score: 0
Accepted
time: 0ms
memory: 14520kb

input:

2 5 10
1 1 2
3 1 2
2 1 2
1 3 2
1 1 2
3 1 2
3 3 2
1 4 2
3 3 2
1 5 1

output:

2
0
1
1
0

result:

ok 5 lines

Test #3:

score: 0
Accepted
time: 4ms
memory: 14976kb

input:

10 100 1000
1 49 4
1 75 9
1 90 3
1 4 6
1 76 4
1 60 9
1 62 2
1 70 1
1 99 3
1 54 2
3 70 1
1 16 4
1 28 8
1 29 6
1 93 5
1 96 4
1 85 9
3 4 6
1 28 2
1 5 5
1 1 3
1 42 2
3 5 5
1 66 1
1 79 10
3 70 1
1 58 8
1 50 5
3 76 4
1 20 9
1 66 4
1 88 2
1 23 4
3 99 3
3 79 10
3 70 1
1 54 8
1 90 6
1 13 9
1 79 4
1 59 6
1 8 ...

output:

70
18
68
112
68
105
119
263
94
111
124
69
71
41
121
130
69
155
51
121
122
49
120
86
14
35
102
205
120
24
180
156
48
104
188
81
115
154
48
178
135
41
52
66
123
144
79
74
176
86
25
28
74
68
39
134
67
101
83
171
206
80
127
134
163
82
115
46
130
112
122
57
41
156
100
135
80
63
123
123
135
115
58
1
83
34...

result:

ok 100 lines

Test #4:

score: 0
Accepted
time: 3ms
memory: 14700kb

input:

100 10 1000
1 9 47
1 1 79
1 5 61
1 2 89
1 6 37
1 7 35
1 4 45
1 6 13
1 8 44
3 2 89
3 7 35
3 5 61
3 4 45
1 10 72
1 8 87
1 9 95
1 1 21
1 6 96
3 6 37
1 7 57
3 9 47
1 10 60
3 1 79
3 8 44
1 4 14
3 10 60
3 9 95
3 10 60
1 2 12
1 3 60
3 8 87
3 9 47
1 3 78
1 7 53
3 8 87
3 8 44
3 7 35
1 2 3
1 4 46
3 3 60
1 8 5...

output:

66
67
52
85
60
80
83
75
86
91

result:

ok 10 lines

Test #5:

score: 0
Accepted
time: 309ms
memory: 16988kb

input:

1000 100 1000000
1 87 431
1 37 630
1 10 767
1 57 932
1 39 264
1 53 544
1 3 742
1 75 698
1 32 816
3 75 698
1 88 229
1 48 333
1 78 672
1 85 497
1 9 480
1 55 649
3 78 672
1 64 665
1 65 518
3 65 518
3 55 649
1 6 381
3 53 544
1 52 457
1 70 842
1 67 248
3 64 665
1 97 494
1 16 247
1 85 945
1 23 735
1 2 991...

output:

220031
226945
226245
220831
219938
223186
218636
223024
218431
221626
227287
226440
221810
222611
220181
221303
219904
224603
223555
220553
224773
222787
227972
218571
227506
226995
215279
223924
222059
226118
226605
223266
219180
221610
227260
222589
220470
225023
221417
224939
219437
218739
225019...

result:

ok 100 lines

Test #6:

score: 0
Accepted
time: 292ms
memory: 45492kb

input:

100000 200000 1000000
1 181524 35385
1 169961 68863
1 124758 23261
1 74985 56436
1 3186 33782
1 105116 51681
1 105110 33639
1 3160 74748
1 81090 49733
1 23779 6996
1 143441 25280
1 79984 1369
1 33783 27010
1 67291 48471
1 53309 51630
1 78939 49071
1 177356 74384
1 91636 71966
1 32312 15406
1 108533 ...

output:

10
8
8
11
9
9
2
9
5
10
5
0
0
6
6
9
19
6
14
12
0
9
2
8
3
10
0
1
7
20
6
6
13
0
1
13
11
0
13
8
1
14
0
14
1
14
9
9
10
0
4
6
0
16
13
23
12
8
1
7
7
10
18
1
8
4
10
12
15
15
21
0
0
3
8
13
4
3
2
0
8
3
7
19
1
2
11
6
3
10
4
17
5
8
3
5
3
9
10
16
4
2
17
5
2
4
8
4
8
10
5
4
6
1
3
17
6
7
22
11
1
2
0
16
5
9
21
3
20
...

result:

ok 200000 lines

Test #7:

score: -100
Time Limit Exceeded

input:

10 200000 1000000
1 68060 3
1 9219 8
1 32172 8
1 71951 1
1 61480 2
1 7696 2
1 163933 7
1 149778 4
1 62148 10
1 199533 3
1 12077 4
1 54839 4
1 103950 6
1 160854 3
1 114869 9
1 151743 8
1 117059 5
1 8355 1
1 117439 6
1 43424 10
1 72346 9
1 95637 9
1 3631 5
1 153680 6
1 86359 6
1 11572 4
1 150678 7
1 1...

output:


result: