10095_SalesRepor

2022-5-16 18:16| 发布者: Hocassian| 查看: 83| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-3-89504536077400-Problem List-采集的数据-后羿采集器.html

Pro.ID

10095

Title

Sales Report

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=10095

AC

0

Submit

0

Ratio

-

时间&空间限制

  • Time Limit: 2000/1000 MS (Java/Others)     Memory Limit: 32768/32768 K (Java/Others)
  • 描述

    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.

    输出

    Description

    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

    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

    Output must a table as described above, row-by-row.

    Sample Input

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

    Sample Output

    -1 10 20
    1 3 0
    2 2 6

    Source

    样例输入

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

    样例输出

    -1 10 20
    1 3 0
    2 2 6

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部