302166: CF413B. Spyke Chatting

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Spyke Chatting

题意翻译

### 题目描述 R2 公司有 $n$ 名员工为其工作。这项工作包括不断交流想法,分享成功的故事和准备迎接即将到来的挑战。为此,R2 使用了著名的即时通讯程序 Spyke。 公司中一共有 $m$ 个聊天室。在每个聊天室中,一些员工会发消息。一名员工可以在多个聊天室中同时交谈。如果某个员工在聊天室中,他可以发送消息,并接收有关该聊天室中消息的通知。如果员工在聊天室中发送消息,则此聊天室的所有其他参与者都会收到消息通知。 现在,专家们正在研究员工之间的有效沟通,为此,他们有一个聊天记录的描述。作为审计专家之一,您将被委托编写一个程序,该程序将使用此数据确定每个员工收到的消息通知总数。 ### 输入格式 第一行包含三个空格分隔的整数 $n$,$m$ 和 $k$(相应地,指员工数量,聊天室数量和聊天记录的数量)。 接下来的 $n$ 行包含大小为 $n \times m$ 的矩阵 $a$,由数字 $0$ 和 $1$ 组成。该矩阵的元素,记录在第 $i$ 行的第 $j$ 列中,如果第 $i$ 位员工是第 $j$ 个聊天室的参与者,则将其表示为等于 $1$,否则元素等于 $0$。假设员工编号从 $1$ 到 $n$,聊天编号从 $1$ 到 $m$。 接下来的 $k$ 行包含聊天记录的描述。第 $i$ 行包含两个空格分隔的整数 $x_i$ 和 $y_i$,意思是员工 $x_i$ 在聊天室 $y_i$ 中发送了一条消息。保证员工 $x_i$ 是聊天室 $y_i$ 的参与者。保证每个聊天至少包含两名员工。 ### 输出格式 共一行,包含 $n$ 个数,第 $i$ 个数代表第 $i$ 个员工收到消息的数量。

题目描述

The R2 company has $ n $ employees working for it. The work involves constant exchange of ideas, sharing the stories of success and upcoming challenging. For that, R2 uses a famous instant messaging program Spyke. R2 has $ m $ Spyke chats just to discuss all sorts of issues. In each chat, some group of employees exchanges messages daily. An employee can simultaneously talk in multiple chats. If some employee is in the $ k $ -th chat, he can write messages to this chat and receive notifications about messages from this chat. If an employee writes a message in the chat, all other participants of the chat receive a message notification. The R2 company is conducting an audit. Now the specialists study effective communication between the employees. For this purpose, they have a chat log and the description of chat structure. You, as one of audit specialists, are commissioned to write a program that will use this data to determine the total number of message notifications received by each employee.

输入输出格式

输入格式


The first line contains three space-separated integers $ n $ , $ m $ and $ k $ $ (2<=n<=2·10^{4}; 1<=m<=10; 1<=k<=2·10^{5}) $ — the number of the employees, the number of chats and the number of events in the log, correspondingly. Next $ n $ lines contain matrix $ a $ of size $ n×m $ , consisting of numbers zero and one. The element of this matrix, recorded in the $ j $ -th column of the $ i $ -th line, (let's denote it as $ a_{ij} $ ) equals $ 1 $ , if the $ i $ -th employee is the participant of the $ j $ -th chat, otherwise the element equals $ 0 $ . Assume that the employees are numbered from $ 1 $ to $ n $ and the chats are numbered from $ 1 $ to $ m $ . Next $ k $ lines contain the description of the log events. The $ i $ -th line contains two space-separated integers $ x_{i} $ and $ y_{i} $ $ (1<=x_{i}<=n; 1<=y_{i}<=m) $ which mean that the employee number $ x_{i} $ sent one message to chat number $ y_{i} $ . It is guaranteed that employee number $ x_{i} $ is a participant of chat $ y_{i} $ . It is guaranteed that each chat contains at least two employees.

输出格式


Print in the single line $ n $ space-separated integers, where the $ i $ -th integer shows the number of message notifications the $ i $ -th employee receives.

输入输出样例

输入样例 #1

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

输出样例 #1

3 3 1 

输入样例 #2

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

输出样例 #2

0 2 3 0 

Input

题意翻译

### 题目描述 R2 公司有 $n$ 名员工为其工作。这项工作包括不断交流想法,分享成功的故事和准备迎接即将到来的挑战。为此,R2 使用了著名的即时通讯程序 Spyke。 公司中一共有 $m$ 个聊天室。在每个聊天室中,一些员工会发消息。一名员工可以在多个聊天室中同时交谈。如果某个员工在聊天室中,他可以发送消息,并接收有关该聊天室中消息的通知。如果员工在聊天室中发送消息,则此聊天室的所有其他参与者都会收到消息通知。 现在,专家们正在研究员工之间的有效沟通,为此,他们有一个聊天记录的描述。作为审计专家之一,您将被委托编写一个程序,该程序将使用此数据确定每个员工收到的消息通知总数。 ### 输入格式 第一行包含三个空格分隔的整数 $n$,$m$ 和 $k$(相应地,指员工数量,聊天室数量和聊天记录的数量)。 接下来的 $n$ 行包含大小为 $n \times m$ 的矩阵 $a$,由数字 $0$ 和 $1$ 组成。该矩阵的元素,记录在第 $i$ 行的第 $j$ 列中,如果第 $i$ 位员工是第 $j$ 个聊天室的参与者,则将其表示为等于 $1$,否则元素等于 $0$。假设员工编号从 $1$ 到 $n$,聊天编号从 $1$ 到 $m$。 接下来的 $k$ 行包含聊天记录的描述。第 $i$ 行包含两个空格分隔的整数 $x_i$ 和 $y_i$,意思是员工 $x_i$ 在聊天室 $y_i$ 中发送了一条消息。保证员工 $x_i$ 是聊天室 $y_i$ 的参与者。保证每个聊天至少包含两名员工。 ### 输出格式 共一行,包含 $n$ 个数,第 $i$ 个数代表第 $i$ 个员工收到消息的数量。

加入题单

算法标签: