[Vijos p1035] greedy gifts

Source: Internet
Author: User

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

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.