#C11269. Warehouse Inventory Contiguous Subsequence Check

    ID: 40566 Type: Default 1000ms 256MiB

Warehouse Inventory Contiguous Subsequence Check

Warehouse Inventory Contiguous Subsequence Check

You are given two sequences of integers: a warehouse inventory list and a list of items to be checked.

The task is to determine whether the items appear as a contiguous subsequence in the warehouse list. A contiguous subsequence is defined as follows: there exists an index \(i\) such that for every \(j\) from 0 to \(M-1\), the condition \[ warehouse[i+j] = items[j] \] holds true.

If the items are found as a contiguous block, output "All items found"; otherwise, output "Check inventory".

inputFormat

The input is read from standard input (stdin) and consists of three lines:

  1. The first line contains two integers \(N\) and \(M\), where \(N\) is the number of bins in the warehouse and \(M\) is the number of items to check.
  2. The second line contains \(N\) integers representing the warehouse inventory.
  3. The third line contains \(M\) integers representing the list of items to check.

outputFormat

The output is written to standard output (stdout) and is a single line containing either "All items found" or "Check inventory" depending on whether the list of items appears as a contiguous subsequence in the warehouse inventory.

## sample
10 3
5 8 12 14 7 20 15 9 6 11
14 7 20
All items found