QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#587204#9303. Message BombhwwwTL 2ms9220kbC++11675b2024-09-24 18:24:332024-09-24 18:25:21

Judging History

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

  • [2024-09-24 18:25:21]
  • 评测
  • 测评结果:TL
  • 用时:2ms
  • 内存:9220kb
  • [2024-09-24 18:24:33]
  • 提交

answer

#include<iostream>
#include<cstdio>
#include<map>
#include<set>
#define ll long long 
using namespace std;
ll n,m,s;
int an[200005];

set <int>q[100005];
map<pair<int ,int>,int>st;
int main()
{
	cin >> n >> m >> s;
	while(s--)
	{
		int t,x,y;
		cin >> t >> x >> y;
		if(t==1)
		{
			st[{x,y}]=1;
			q[y].insert(x);
			continue;
		}
		if(t==2)
		{
			st[{x,y}]=0;
			q[y].erase(x);
			continue;
		}
		if(t==3)
		{
//			bool v[200005]={0};
			for(int i : q[y])
			{
				if(st[{i,y}]==1&&x!=i)
				{
//					v[i]=1;
					an[i]++;
				}
			}
			continue;
		}
		
	}
	for(int i=1;i<=m;i++)
	{
		printf("%d\n",an[i]);
	}
	return 0;
}

详细

Test #1:

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

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: 2ms
memory: 9128kb

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: 0ms
memory: 8500kb

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: 2ms
memory: 9220kb

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: -100
Time Limit Exceeded

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:


result: