200712025-12-31 14:28:47szabelrBeszerzéscpp17Accepted 50/5028ms2628 KiB
// Beszerzés.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <vector>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, m, k;
    cin >> n >> m >> k;
    vector<vector<pair<int,int>>> etelek(n + 1);
    vector<long long> alapanyagok(k + 1, 0);
    for (int i = 1; i <= n; i++) {
        int x;
        cin >> x;
        for (int y = 0; y < x; y++)
        {
            int q, z;
            cin >> q >> z;
            etelek[i].push_back({ q,z });
        }
    }
    vector<long long>db(n + 1, 0);
    for (int i = 1; i <= m; i++)
    {
        int x;
        cin >> x;
        for (int y = 0; y < x; y++)
        {
            int z, q;
            cin >> z >> q;
            db[z] = db[z]+ q;
        }
    }
    for (int i = 1; i <= n; i++)
    {
        if(db[i]!=0)
        {
            for (auto a : etelek[i])
            {
                alapanyagok[a.first] += a.second * db[i];
            }
        }
        
    }
    for (int i = 1; i <= k; i++)
        cout << alapanyagok[i] << " ";
}

// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu

// Tips for Getting Started: 
//   1. Use the Solution Explorer window to add/manage files
//   2. Use the Team Explorer window to connect to source control
//   3. Use the Output window to see build output and other messages
//   4. Use the Error List window to view errors
//   5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
//   6. In the future, to open this project again, go to File > Open > Project and select the .sln file
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted1ms316 KiB
subtask27/7
2Accepted19ms1968 KiB
3Accepted19ms1968 KiB
4Accepted20ms2040 KiB
5Accepted19ms1964 KiB
6Accepted19ms1968 KiB
subtask312/12
7Accepted1ms512 KiB
8Accepted1ms512 KiB
9Accepted1ms316 KiB
10Accepted1ms316 KiB
11Accepted1ms316 KiB
12Accepted1ms500 KiB
13Accepted1ms316 KiB
14Accepted1ms508 KiB
15Accepted1ms316 KiB
16Accepted1ms316 KiB
17Accepted1ms316 KiB
subtask413/13
18Accepted19ms1968 KiB
19Accepted19ms1968 KiB
20Accepted20ms2040 KiB
21Accepted19ms1964 KiB
22Accepted19ms1968 KiB
23Accepted19ms2096 KiB
24Accepted19ms2112 KiB
25Accepted19ms2260 KiB
26Accepted20ms2084 KiB
27Accepted19ms2208 KiB
28Accepted21ms2224 KiB
29Accepted21ms2300 KiB
30Accepted21ms2224 KiB
31Accepted23ms2224 KiB
32Accepted23ms2224 KiB
33Accepted24ms2340 KiB
34Accepted23ms2276 KiB
35Accepted20ms2092 KiB
36Accepted21ms2224 KiB
subtask518/18
37Accepted1ms512 KiB
38Accepted19ms1968 KiB
39Accepted19ms1968 KiB
40Accepted20ms2040 KiB
41Accepted19ms1964 KiB
42Accepted19ms1968 KiB
43Accepted1ms512 KiB
44Accepted1ms316 KiB
45Accepted1ms316 KiB
46Accepted1ms316 KiB
47Accepted1ms500 KiB
48Accepted1ms316 KiB
49Accepted1ms508 KiB
50Accepted1ms316 KiB
51Accepted1ms316 KiB
52Accepted1ms316 KiB
53Accepted19ms2096 KiB
54Accepted19ms2112 KiB
55Accepted19ms2260 KiB
56Accepted20ms2084 KiB
57Accepted19ms2208 KiB
58Accepted21ms2224 KiB
59Accepted21ms2300 KiB
60Accepted21ms2224 KiB
61Accepted23ms2224 KiB
62Accepted23ms2224 KiB
63Accepted24ms2340 KiB
64Accepted23ms2276 KiB
65Accepted20ms2092 KiB
66Accepted21ms2224 KiB
67Accepted26ms2100 KiB
68Accepted27ms2248 KiB
69Accepted25ms2020 KiB
70Accepted23ms2100 KiB
71Accepted20ms1956 KiB
72Accepted28ms2116 KiB
73Accepted28ms1844 KiB
74Accepted27ms2356 KiB
75Accepted24ms2356 KiB
76Accepted26ms2208 KiB
77Accepted28ms2628 KiB
78Accepted21ms2080 KiB