#K4771. Grid Coverage Verification

    ID: 28259 Type: Default 1000ms 256MiB

Grid Coverage Verification

Grid Coverage Verification

You are given an integer ( n ) representing the dimensions of a grid, where the grid consists of ( n \times n ) cells. In addition, you are provided with a list of integers that represent the number of available tiles for various types. Your task is to determine whether these tiles can exactly cover the grid. That is, you need to check if the sum of the tile counts equals ( n^2 ). If the condition holds, print "YES"; otherwise, print "NO".

inputFormat

The input is provided via standard input (stdin) and consists of two lines:

  1. The first line contains a single integer ( n ), the size of the grid.
  2. The second line contains space-separated integers representing the available tile counts.

For example:

4 8 4 4

outputFormat

Output a single line via standard output (stdout) containing either "YES" if the grid can be exactly covered by the tiles, or "NO" otherwise.## sample

4
8 4 4
YES

</p>