Log inSign up
Problems / A016

Lotto 30

100 ptsCases 15Set by dongbinna
Added October 30.
1 solved1 attempted1 submissionssolvers took 1.0 tries on average

Statement

When someone playing "Lotto 30" buys one ticket, they pick 6 numbers, with no repeats, from the natural numbers 1 through 30 as their lotto numbers. If the 6 numbers they picked match the 6 winning lotto numbers that get announced, they collect the first prize.

The order of the picked numbers does not matter. If all 6 numbers match, it is a first prize win. For example, say you buy one ticket and pick [1, 7, 8, 24, 5, 16]. If the 6 winning numbers announced are [16, 5, 1, 7, 8, 24], that counts as a win. If the 6 winning numbers announced are [1, 7, 8, 24, 5, 15], that does not count as a win.

Assume you buy one ticket for each round from round 1 through round N, always with the same set of numbers. Given the winning lotto numbers for the N rounds, write a program that works out how many wins there are in total.

Input and Output Examples

Example 1

Input

3, [1, 7, 8, 24, 5, 16], [[1, 7, 8, 24, 5, 16], [16, 5, 1, 7, 8, 24], [1, 7, 8, 24, 5, 15]]

Output

2

Example 2

Input

5, [1, 2, 3, 4, 5, 6], [[1, 2, 3, 4, 5, 30], [1, 2, 3, 4, 5, 20], [15, 2, 3, 4, 22, 6], [3, 5, 9, 11, 23, 6], [6, 5, 4, 3, 2, 1]]

Output

1

Input

  • First the number of lotto rounds N is given as a natural number. (N is a natural number less than or equal to 300,000.)

  • Next an array selected is given, holding the 6 lotto numbers picked at purchase. Each of those lotto numbers is one of the natural numbers 1 through 30, and they do not repeat.

  • Next a two-dimensional array lottos is given, holding the winning lotto numbers for each round from round 1 through round N. The 6 winning numbers in each round do not repeat, and each one is one of the natural numbers 1 through 30.

Output

  • Given the winning lotto numbers for the N rounds, return how many wins there are in total.

Requirements

  • You must write a solution(N, selected, lottos) function and return the answer
  • Trailing spaces at the end of a line and blank lines at the end of the output are ignored when grading
  • The languages you can use are Python and JavaScript
  • The memory limit is 256MB. The browser does not measure it, it only states it
  • The time limit is set by measuring the setter's reference solution on the same runtime
  • On this problem you submit code, not a prompt. That code runs in the browser on this device, and all that goes to the server is a fingerprint of the output and the time it took. Whether it is correct is decided by the server. The run time is a number each device reports, so the code and the device details are posted next to it on the leaderboard.
  • The output has to match the expected value down to the character. A space inside a line counts the same as any other character.
  • There are 15 cases, and 2 of them show the input together with the expected output. The rest are used only when you submit and are not shown on this page.
  • You have to pass all 15 cases to solve this.
Read the requirements carefully before solving. Tampering with the grading to make a submission look like a pass can get you sanctioned if caught. The code you submit is published on the leaderboard along with the result.

Examples

2 public cases. Judging also uses hidden cases. You have to pass all 15 cases to solve this.

Input
Expected output
3, [1, 7, 8, 24, 5, 16], [[1, 7, 8, 24, 5, 16], [16, 5, 1, 7, 8, 24], [1, 7, 8, 24, 5, 15]]
2
5, [1, 2, 3, 4, 5, 6], [[1, 2, 3, 4, 5, 30], [1, 2, 3, 4, 5, 20], [15, 2, 3, 4, 22, 6], [3, 5, 9, 11, 23, 6], [6, 5, 4, 3, 2, 1]]
1

Notes

Background that helps with solving. The rules you have to follow are in the input and output specs and the requirements above.

This is problem 6 of practice test 1 in the original.

Solution

Your code runs on this device. Only the fingerprint of the output and the elapsed time go to the server. The server decides whether it is correct.

0 chars1 lineMemory 256MB (recorded only)Reference 26ms

Submitting requires you to log in. Running against the public cases works without one.

You can test with 2 public cases. Submitting runs the hidden cases too.

People who solved this problem

The time shown is the time spent solving. Input reading time is outside the solver's control, so it is excluded. And since each device reports this value itself, we record which device measured it.

1bampal21.10s186 charsPythonWindows NT 10.0 / Chrome/156.0.0.0 / 8코어 / 16GB

Input read time 2.25s (excluded from the ranking)

Log in and you can see the code once you solve this problem.