当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

2380:Sales Report

题目描述
The Unknown Trading Company have installed a new inventory-tracking system, which stores a complete database of goods and trading points worldwide. Each salespoint and each item was assigned an integer unique identifier (id). For every sale, the system logs id of the item, number of items sold, and id of the salespoint.

Your task is to output a summary report, tabulating total sales by items and salespoints. The report must be a two-dimensional table, with the first row containing item ids in increasing order, first column containing salespoint ids in increasing order, and values inside the table representing total sales of corresponding item from the corresponding salespoint. The value in first column of the first row must be −1. The values in cells without corresponding sales must be 0.
输入解释
Input contains number of records N, followed by N triplets of integers qi si vi, where qi -- item id, si -- salespoint id, vi -- number of items sold.
1 ≤ N ≤ 500000, 1 ≤ qi, si, vi ≤ 109, the summary table will have no more than 108 cells, the summary value in each cell will not exceed than 231−1.
输出解释
Output must a table as described above, row-by-row.
输入样例
4
10 1 3
20 2 5
10 2 2
20 2 1
输出样例
-1 10 20
1 3 0
2 2 6
提示
This problem has huge input and output data,use scanf() and printf() instead of cin and cout to read data to avoid time limit exceed.

该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-2380

最后修改于 2020-10-29T06:31:04+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
3000 65536