1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
| k=int(input())
name={}
type={}
for i in range(k):
x,y,z=input().split()
z=float(z)
if x not in name:
name[x]=z
else:
name[x]+=z
if y not in type:
type[y]=z
else:
type[y]+=z
list1=list(name.keys())
list2=list(type.keys())
print(len(list1))
print(len(list2))
list1.sort()
list2.sort()
for i in list1:
print(i,"%.2f"%name[i])
for i in list2:
print(i,"%.2f"%type[i])
|