2069 - ACM Scoring

Created by Carlos Joa Fong
Added by ymondelo20 (2012-10-12)
Limits
Total Time: 4000 MS | Test Time: 2000 MS |Memory: 62 MB | Output: 64 MB | Size: 29 KB
Enabled languages
Available in

Description

In ACM ICPC, teams are ranked according to the most problems solved. Teams who solve the same number of problems are ranked by least total time. The total time is the sum of the time consumed for each problem solved. The time consumed for a solved problem is the time elapsed from the beginning of the contest to the submittal of the accepted run plus 20 penalty minutes for every previously rejected run for that problem regardless of submittal time. There is no time consumed for a problem that is not solved. You can assume that teams are working one problem at a time.
At the start of the contest, your team decided to spend the first five minutes of the contest to estimate the difficulty of each problem. For each problem, your team has determined the number of minutes it would take to solve each problem. Your team is super accurate: you are able to solve each problem in its first submission, so you will never get a 20 minute penalty due to a failed submission.
Given the time estimates for each problem, what will be the optimal score (number of solved problems and penalty minutes) of your team?
In ACM ICPC, teams are ranked according to the most problems solved. Teams who solve the same number of problems are ranked by least total time. The total time is the sum of the time consumed for each problem solved. The time consumed for a solved problem is the time elapsed from the beginning of the contest to the submittal of the accepted run plus 20 penalty minutes for every previously rejected run for that problem regardless of submittal time. There is no time consumed for a problem that is not solved. You can assume that teams are working one problem at a time.
At the start of the contest, your team decided to spend the first five minutes of the contest to estimate the difficulty of each problem. For each problem, your team has determined the number of minutes it would take to solve each problem. Your team is super accurate: you are able to solve each problem in its first submission, so you will never get a 20 minute penalty due to a failed submission.
Given the time estimates for each problem, what will be the optimal score (number of solved problems and penalty minutes) of your team?
In ACM ICPC, teams are ranked according to the most problems solved. Teams who solve the same number of problems are ranked by least total time. The total time is the sum of the time consumed for each problem solved. The time consumed for a solved problem is the time elapsed from the beginning of the contest to the submittal of the accepted run plus 20 penalty minutes for every previously rejected run for that problem regardless of submittal time. There is no time consumed for a problem that is not solved. You can assume that teams are working one problem at a time.
At the start of the contest, your team decided to spend the first five minutes of the contest to estimate the difficulty of each problem. For each problem, your team has determined the number of minutes it would take to solve each problem. Your team is super accurate: you are able to solve each problem in its first submission, so you will never get a 20 minute penalty due to a failed submission.
Given the time estimates for each problem, what will be the optimal score (number of solved problems and penalty minutes) of your team?

Input specification

First line of input contains the number of test cases T (T <= 1000) to follow. Each test case consists of two lines:
  • First line contains two integers, D (a multiple of 10 between 60 and 300), the contest duration, and P (1 <= P <= 15), the number of problems to solve.
  • Second line consists of P integers, Ti, (1 <= Ti <= 1000), the number of minutes it takes your team to solve the ith problem (1 <= i <= P ).
First line of input contains the number of test cases T (T <= 1000) to follow. Each test case consists of two lines:
  • First line contains two integers, D (a multiple of 10 between 60 and 300), the contest duration, and P (1 <= P <= 15), the number of problems to solve.
  • Second line consists of P integers, Ti, (1 <= Ti <= 1000), the number of minutes it takes your team to solve the ith problem (1 <= i <= P ).
First line of input contains the number of test cases T (T <= 1000) to follow. Each test case consists of two lines:
  • First line contains two integers, D (a multiple of 10 between 60 and 300), the contest duration, and P (1 <= P <= 15), the number of problems to solve.
  • Second line consists of P integers, Ti, (1 <= Ti <= 1000), the number of minutes it takes your team to solve the ith problem (1 <= i <= P ).

Output specification

For each test case, output the optimal number of problems your team will be able to solve, and, for this number of solved problems, the optimal number of penalty minutes your team will consume.
For each test case, output the optimal number of problems your team will be able to solve, and, for this number of solved problems, the optimal number of penalty minutes your team will consume.
First line of input contains the number of test cases T (T <= 1000) to follow. Each test case consists of two lines:
  • First line contains two integers, D (a multiple of 10 between 60 and 300), the contest duration, and P (1 <= P <= 15), the number of problems to solve.
  • Second line consists of P integers, Ti, (1 <= Ti <= 1000), the number of minutes it takes your team to solve the ith problem (1 <= i <= P ).

Sample input

3
240 9
30 20 80 50 45 35 40 45 30
120 5
31 31 31 31 30
60 2
120 200

Sample output

6 650
3 198
0 0

Hint(s)

http://coj.uci.cu/contest/
http://coj.uci.cu/contest/
http://coj.uci.cu/contest/