#K72372. Contiguous Subarray Sum

    ID: 33739 Type: Default 1000ms 256MiB

Contiguous Subarray Sum

Contiguous Subarray Sum

Given an array of n integers, determine whether there exists a contiguous subarray of length k whose sum is at least t. Formally, given the array (A = [a_1, a_2, \ldots, a_n]) and integers k and t, check if there exists an index i ((1 \le i \le n-k+1)) such that (\sum_{j=i}^{i+k-1} a_j \ge t).

Constraints:
- (1 \le n \le 10^5)
- (1 \le k \le n)
- (-10^9 \le a_i, t \le 10^9)

inputFormat

The first line contains three integers n, k, and t. The second line contains n space-separated integers representing the elements of the array.

outputFormat

Output a single word: "YES" if a contiguous subarray of length k with a sum at least t exists, and "NO" otherwise.## sample

10 3 15
1 2 3 4 5 6 7 8 9 10
YES