A9410 | Spyke Chatting
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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.
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.
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
暂无题解
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted