You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
548 B
C++
30 lines
548 B
C++
#define _CRT_SECURE_NO_WARNINGS
|
|
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
|
|
#include <bits/stdc++.h>
|
|
using namespace std;
|
|
int main()
|
|
{
|
|
map<string, map<string, int>> M;
|
|
int n, m, x;
|
|
cin >> n;
|
|
string s1, s2;
|
|
while (n--)
|
|
{
|
|
M.clear();
|
|
cin >> m;
|
|
while (m--)
|
|
{
|
|
cin >> s1 >> s2 >> x;
|
|
M[s2][s1] += x;
|
|
}
|
|
for (auto &x : M)
|
|
{
|
|
cout << x.first << endl;
|
|
for (auto &y : x.second)
|
|
cout << " |----" << y.first << '(' << y.second << ')' << endl;
|
|
}
|
|
if (n)
|
|
cout << endl;
|
|
}
|
|
return 0;
|
|
} |