#C1460. Secure File Transfer Validation
Secure File Transfer Validation
Secure File Transfer Validation
You are given a sequence of integers representing the sizes of file chunks, and an integer M representing the maximum allowed chunk size for transferring files. A file transfer is considered secure if:
- Every chunk size is less than or equal to M.
- The sequence of chunk sizes is in a non-increasing order (i.e. each chunk is not larger than the previous one).
Formally, if the sequence of chunk sizes is \(c_1, c_2, \ldots, c_n\), then the file transfer is secure if \(c_i \le M\) for all \(1 \le i \le n\) and \(c_i \ge c_{i+1}\) for all \(1 \le i < n\).
Your task is to determine whether a given list of chunk sizes can be transmitted securely based on the above criteria.
inputFormat
The input is provided through standard input (stdin) and has the following format:
n M c1 c2 ... cn
where:
- \(n\) is an integer that represents the number of chunks.
- \(M\) is the maximum allowed size for any chunk.
- \(c1, c2, \ldots, cn\) are integers representing the sizes of the chunks, given in order.
outputFormat
The output should be printed to standard output (stdout) and must be either True
or False
(without quotes). Print True
if the file transfer is secure according to the criteria, otherwise print False
.
5 4
4 3 2 2 1
True