Why do I have to be mentally retarded? It's just because I haven't been coding for too long...
Tomorrow's task is to do some difficult things. When I get tired, I will take care of the room. If I can't, I will go to bed. I don't want to do anything else.
program vijos_p1035;var namelist:array[1..10] of string; ans:array[1..10] of integer; n,i,j,ni,money:integer; s,ss:string;function loc(st:string):integer;var i:integer;begin i:=1; while namelist[i]<>st do inc(i); exit(i);end;begin {main} readln(n); for i:=1 to n do readln(namelist[i]); for j:=1 to n do begin readln(s); readln(money,ni); for i:=1 to ni do begin readln(ss); inc(ans[loc(ss)],money div ni); end; if ni<>0 then dec(ans[loc(s)],money div ni * ni); end; for i:=1 to n do writeln(namelist[i],‘ ‘,ans[i]);end.
Greedy gifts
Test data #0: accepted, time = 0 MS, Mem = 744 kib, score = 10
Test data #1: accepted, time = 0 MS, Mem = 744 kib, score = 10
Test data #2: accepted, time = 15 MS, Mem = 744 kib, score = 10
Test data #3: accepted, time = 15 MS, Mem = 744 kib, score = 10
Test data #4: accepted, time = 0 MS, Mem = 744 kib, score = 10
Test data #5: accepted, time = 0 MS, Mem = 744 kib, score = 10
Test data #6: accepted, time = 0 MS, Mem = 744 kib, score = 10
Test data #7: accepted, time = 0 MS, Mem = 748 kib, score = 10
Test data #8: accepted, time = 0 MS, Mem = 744 kib, score = 10
Test data #9: accepted, time = 0 MS, Mem = 740 kib, score = 10
Accepted, time = 30 MS, Mem = 748 kib, score = 100