Problem:


Score: 300 points

Problem Statement

M-kun is a student in Aoki High School, where a year is divided into N terms.

There is an exam at the end of each term. According to the scores in those exams, a student is given a grade for each term, as follows:

For the first through (K-1)-th terms: not given.

For each of the K-th through N-th terms: the multiplication of the scores in the last K exams, including the exam in the graded term.

M-kun scored A_i in the exam at the end of the i-th term.

For each i such that K+1 \leq i \leq N, determine whether his grade for the i-th term is strictly greater than the grade for the (i-1)-th term.

Constraints

2 \leq N \leq 200000

1 \leq K \leq N-1

1 \leq A_i \leq 10^{9}

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N K
A_1 A_2 A_3 \ldots A_N

Output

Print the answer in N-K lines.

The i-th line should contain Yes if the grade for the (K+i)-th term is greater than the grade for the (K+i-1)-th term, and No otherwise.

Sample Input 1

5 3
96 98 95 100 20

Sample Output 1

Yes
No

His grade for each term is computed as follows:

3-rd term: (96 \times 98 \times 95) = 893760

4-th term: (98 \times 95 \times 100) = 931000

5-th term: (95 \times 100 \times 20) = 190000

Sample Input 2

3 2
1001 869120 1001

Sample Output 2

No

Note that the output should be No if the grade for the 3-rd term is equal to the grade for the 2-nd term.

Sample Input 3

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

Sample Output 3

Yes
Yes
No
Yes
Yes
No
Yes
Yes



Sample input:
5 3
96 98 95 100 20


Sample output:
Yes
No

Submission status: Time Limit Exceeded

Solution code:
n,k = map(int,input().split())
a = list(map(int,input().split()))
b = a[:]
for i in range(1,k):
    a[i] = a[i] * a[i-1]
for i in range(k,n):
    a[i] = a[i] * a[i-1] // b[i-k]
    if a[i] > a[i-1]:
        print('Yes')
    else:
        print('No')

Submission status: Time Limit Exceeded

Solution code:
N, K = list(map(int, input().split()))
scores = list(map(int, input().split()))
ave = [0] * (N - (K - 1))
for i in range(K - 1, N):
    ave[i - (K - 1)] = sum(scores[i - (K - 1):i+1]) / K

pre = -1
for i in range(N):
    if i < K - 1: # indexがK-1回目 かどうか
        continue
    now = ave[i - (K - 1)]
    if pre != -1: # indexがK回目 かどうか
        print('Yes' if now > pre else 'No')
    pre = now

Submission status: Time Limit Exceeded

Solution code:
n,k = map(int,input().split())
A = list(map(int,input().split()))

sc = [0]*(n-k+1)
sc[0] = 1

for i in range(k):
    sc[0] *= A[i]

for i in range(1,n-k+1):
    sc[i] = (sc[i-1]/A[i-1])*A[k-1+i]
    if sc[i] > sc[i-1]:
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

Solution code:
import functools
import operator

N, K = input().split(" ")
A = [int(i) for i in input().split(" ")]
N = int(N)
K = int(K)

res = N - K
last = functools.reduce(operator.mul, A[0:K])

for i in range(1, res+1):
  mul = functools.reduce(operator.mul, A[i:K+i])
  if mul > last:
    print("Yes")
  else:
    print("No")
  last = mul

Submission status: Time Limit Exceeded

Solution code:
n,k=map(int,input().split())
a=list(map(int,input().split()))
count=0
ans=None
d=0
for i in range(n-k+1):
  if d==0:
    d=1
    gakki=1
    for j in range(count,k+count):
      gakki*=a[j]
      
  else:
    gakki/=a[count]
    gakki*=a[k+count]
    count+=1
  
  if ans is None:
    ans=gakki
  else:
    if ans<gakki:
      print('Yes')
      ans=gakki
    else:
      print("No")
      ans=gakki

Submission status: Time Limit Exceeded

Solution code:
import functools


n, k = list(map(int, input().split()))

scores = list(map(int, input().split()))

answers = []

prev_mul_scores_last_k = functools.reduce(lambda acc, score: acc * score, scores[:k])

prev_score = scores[0]

for i in range(k, n):
    mul_scores_last_k = (prev_mul_scores_last_k // prev_score) * scores[i]

    if prev_mul_scores_last_k < mul_scores_last_k:
        answers.append('Yes')
    else:
        answers.append('No')

    prev_mul_scores_last_k = mul_scores_last_k
    prev_score = scores[i - (k - 1)]

for answer in answers:
    print(answer)

Submission status: Time Limit Exceeded

Solution code:
N, K = [ int(v) for v in input().split(" ") ]
points = [ int(v) for v in input().split(" ") ]

results = []

for i in range(K, N+1):
  next_score = 1
  for p in points[i-K:i]:
    next_score *= p
  results.append(next_score)
  
for i in range(1, len(results)):
  if results[i] > results[i-1]:
    print("Yes")
  else:
    print("No")

Submission status: Time Limit Exceeded

Solution code:
n, k = map(int, input().split())
a = list(map(int, input().split()))

# n学期制 -> n回のテスト
# k学期以降の成績の総乗

import functools
import operator

res = []
for i in range(k-1, n):
    # print(a[i-(k-1):i+1])
    pai = functools.partial(functools.reduce, operator.mul)
    res.append(pai(a[i-(k-1):i+1]))

for j in range(1, len(res)):
    if res[j] > res[j-1]:
        print('Yes')
    else:
        print('No')

Submission status: Time Limit Exceeded

Solution code:
N, K = map(int,input().split())
A = list(map(int,input().split()))
S = 1
for i in range(K):
    S *= A[i]
for i in range(N-K):
    s = S / A[i] * A[i+K]
    if  S < s:
        print("Yes")
    else:
        print("No")
    S = s

Submission status: Time Limit Exceeded

Solution code:
N,K = map(int,input().split())
a = list(map(int,input().split()))
t = []
for i in range(N-K+1):
    s = 1
    for j in range(0,K):
        s = s * a[K+i-j-1]
    t.append(s)
    if i != 0:
        if t[i-1]<t[i]:
            print("Yes")
        else:
            print("No")

Submission status: Time Limit Exceeded

Solution code:
import functools

def read():
    N, K = map(int, input().split(' '))
    As = list(map(int, input().split(' ')))
    return N, K, As

def mul(l):
    return functools.reduce(lambda x, y: x * y, l)

def fun(N, K, As):
    for i in range(N - K):
        prev = mul(As[i:i+K])
        current = mul(As[i+1:i+K+1])
        if current > prev:
            print('Yes')
        else:
            print('No')

if __name__ == '__main__':
    N, K, As = read()
    fun(N, K, As)

Submission status: Time Limit Exceeded

Solution code:
N,K = map(int,input().split())
A = list(map(int,input().split()))
for i in range(1,N):
    A[i] *= A[i-1]
A = [1] + A
for i in range(K,N):
    if A[i]/A[i-K] < A[i+1]/A[i+1-K]:
        print('Yes')
    else:
        print('No')

Submission status: Time Limit Exceeded

Solution code:
N, K = [int(x) for x in input().strip().split(" ")]
A = [int(x) for x in input().strip().split(" ")]

def mul(A):
    b = 1
    for a in A:
        b *= a
    return b

scores = [mul(A[i-K+1:i+1]) for i in range(K-1, N)]

for i, S in enumerate(scores):
    if i == 0:
        continue
    if S > scores[i - 1]:
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

Solution code:

n, k = (int(x) for x in input().split())
a_list = list(map(int, input().split()))

for i in range(k, n):

    p = 1
    former_p = 1

    for j in range(i - k, i) :
        p = p * a_list[j + 1]

    former_p = p / a_list[i] * a_list[i - k]

    # for j in range(i - k, i) :
    #     p = p * a_list[j + 1]
    #     former_p = former_p * a_list[j]

    # print("p : {0}".format(p))
    # print("former_p : {0}".format(former_p))

    if former_p < p : 
        print('Yes')
    else :
        print('No')

Submission status: Time Limit Exceeded

Solution code:
n,k = map(int,input().split())
a = list(map(int,input().split()))
p = 0
if n <= 2:
    if a[0] < a[1]:
        exit(print('Yes'))
    else:
        exit(print('No'))
p = 1
for i in range(k): p *= a[i]
for i in range(k,n):
    t = p * a[i]
    p *= a[i-k]
    if p < t:
        print('Yes')
    else:
        print('No')
    p = t

Submission status: Time Limit Exceeded

Solution code:
N ,K = map(int,input().split())
A = list(map(int,input().split()))

num = N-K
X = 1
li = [1]*(N+1)
for i in range(N):
    li[i+1] = li[i]*A[i]

Y = li[K]
    
for i in range(K+1,N+1):
    Z = li[i]//li[i-K]
    if Z > Y:
        print("Yes")
    else:
        print("No")
    Y = Z

Submission status: Time Limit Exceeded

Solution code:
n, k = map(int, input().split())
a = list(map(int, input().split()))

score = 1
for i in range(k):
    score *= a[i]

head = a[0]
pre_score = score
for i in range(k, n):    
    score = score * a[i] / head
    if score > pre_score:
        print("Yes")
    else:
        print("No")
    head = a[i-k+1]
    pre_score = score

Submission status: Time Limit Exceeded

Solution code:
n,k=map(int,input().split())
A=list(map(int,input().split()))
for i in range(n-k+1):
  if i==0:
    temp=1
    for j in range(k):
      if A[j]!=1:
        temp*=A[j]
  else:
    newtemp=temp*A[i+k-1]//A[i-1]
    print("Yes" if newtemp>temp else "No")
    temp=newtemp

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-

def main():
    import sys

    N,K = list(map(int, sys.stdin.readline().split()))
    A_list = list(map(int, sys.stdin.readline().split()))
    point_K = 1
    
    for i in range(K):
        point_K *= A_list[i]
    
    current = 1
    prev = point_K

    for i in range(K, len(A_list)):
        current = prev / A_list[i-K] * A_list[i]

        if current > prev:
            print("Yes")
        else:
            print("No")
        
        prev = current


if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
n, k = map(int, input().split())
a = list(map(int, input().split()))
s = 1
ans=[]
for i in range(k):
    s *= a[i]
ans.append(s)
for i in range(k, n):
    ans.append(ans[i - k] * a[i] // a[i - k])
    # print(ans)
    if ans[i - k] < ans[i - k + 1]:
        print("Yes")
    else:
        print("No")
    # print(ans)

Submission status: Time Limit Exceeded

Solution code:
N, K= map(int, input().split(' '))
A = list(map(int, input().split(' ')))
a = [0] * 200010

def N_score(n):
    Score = 1
    if(a[n - 1] == 0):
        for i in range(n - (K - 1), n + 1):
            Score *= A[i]
        a[n] = Score
        return Score
    else:
        a[n] = a[n-1]/A[n-(K-1)-1]*A[n]
        return a[n]

for i in range(K, N):
    if(N_score(i-1) < N_score(i)):
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

Solution code:
import copy
n, k = map(int, input().split())
a = list(map(int, input().split()))
memo = copy.copy(a)
for i in range(k, n+1, 1):
    for j in range(i-k, i-1, 1):
        memo[i-1] *= a[j]
for i in range(k, n, 1):
    if memo[i-1] < memo[i]:
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

Solution code:
def Marks():
    
    num = list(map(int,input().split()))

    data = list(map(int,input().split()))

    count = 0

    for i in range(num[1], num[0]):
        
        kyouka_be = 1
        kyouka_af = 1
        
        for j in range(num[1]): 
        
            kyouka_be = kyouka_be*data[j+count]
            kyouka_af = kyouka_af*data[j+count+1]
            
        if kyouka_be >= kyouka_af:
            print('No')
            
        else:
            print('Yes')

        count = count + 1

if __name__ == '__main__':
    Marks()

Submission status: Time Limit Exceeded

Solution code:
N, K = map(int,input().split())
A = list(map(int,input().split()))
lscore = [0]*K
for i in range(K,N+1):
    score = 1
    if i == K:
        for j in range(K):
            score *= A[j]
        lscore.append(score)
    else:
        score = lscore[i-1]*A[i-1]/A[i-K-1]
        lscore.append(score)
        if lscore[i] > lscore[i-1]:
            print("Yes")
        else:
            print("No")

Submission status: Time Limit Exceeded

Solution code:
n,k=map(int,input().split())
a=list(map(int,input().split()))
ans=1
ANS=1
for i in range(n-k+1):
    ANS=ans
    if i!=0:
        ans=ans//a[i-1]*a[i+j]
    else:
        for j in range(k):
            ans*=a[j]
    if i>0:
        if ANS<ans:
            print("Yes")
        else:
            print("No")

Submission status: Time Limit Exceeded

Solution code:
cons = [int(i) for i in input().split()]
numbers = [int(i) for i in input().split()]

for i in range(cons[0]-cons[1]):
  first =1
  second =1
  for con in range(i,cons[1]+i):
    first *=numbers[con]
    second *= numbers[con+1]
  if first < second:
    print('Yes')
  else:
    print('No')

Submission status: Time Limit Exceeded

Solution code:
n,k = list(map(int, (input().split())))
a = list(map(int, (input().split())))
bkresult = 0
result = 1

for i in range(k,n+1):
    for j in range(i-k,i):
        result = result * a[j]
    if bkresult == 0:
        bkresult = 0
    elif bkresult < result:
    	print("Yes")
    else:
	    print("No")
    bkresult = result
    result = 1

Submission status: Time Limit Exceeded

Solution code:
from functools import reduce
import operator

NK = list(map(int, input().split(' ')))
N = NK[0]
K = NK[1]
A_list = list(map(int, input().split(' ')))
score_list = []

for g in range(K, N+1):
    score = reduce(operator.mul, A_list[g-K: g])
    score_list.append(score)

for i in range(len(score_list) - 1):
    if (score_list[i] < score_list[i+1]):
        print('Yes')
    else:
        print('No')

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python3
import sys

YES = "Yes"
NO = "No"

N,K = list(map(int, input().split()))
A = list(map(int, input().split()))

scores = [0] * K
pre = A[0]
scores[0] = A[0]
i = 1
while i < K:
    scores[i] = A[i]
    pre = pre * A[i]
    i += 1

while i < N:
    if A[i] > scores[i % K]:
        print(YES)
    else:
        print(NO)
    scores[i % K] = A[i]
    i += 1

Submission status: Time Limit Exceeded

Solution code:
N,K = [int(i) for i in input().split(' ')]
marks = [int(i) for i in input().split(' ')]
grades = []
for i in range(K-1,N):
    grade = marks[i]
    for j in range(1,K):
        grade *= marks[i-j]
    grades.append(grade)
for i in range(N-K):
    if grades[i]<grades[i+1]:
        print("Yes")
    else : print("No")

Submission status: Time Limit Exceeded

Solution code:
# from operator import mul
# from functools import reduce

N, K = map(int,input().split())
A = list(map(int, input().split()))

hyouten_count = N - K

result_list = []

for i in range(K-1, N):
    # num = reduce(mul, A[0:i])
    # print(num)
    result = 1
    for j in range(K):
        result = result * A[i - j]
    # print(result)
    result_list.append(result)


for n in range(1, len(result_list)):
    if result_list[n] > result_list[n-1]:
        print('Yes')
    else:
        print('No')

Submission status: Time Limit Exceeded

Solution code:
N,K = map(int,input().split())
A = list(map(int,input().split()))

be = A[0:K]
b = 1
for i in be:
    b *= i
for i in range(N-K):
    af = A[i+1:i+K+1]
    a = 1
    for i in af:
        a *= i
    if b < a :
        print("Yes")
    else:
        print("No")
    b = a

Submission status: Time Limit Exceeded

Solution code:
import functools
import operator

n,k=map(int,input().split())
a=list(map(int,input().split()))

pi=[]
pi.append(functools.reduce(operator.mul, a[0:k]))

for i in range(1,n-k+1):
  pi.append(int((pi[i-1]/a[i-1])*a[i-1+k]))
  if pi[i-1]<pi[i]:
    print('Yes')
  else:
    print('No')

Submission status: Time Limit Exceeded

Solution code:
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))

c = N - K + 1
l = []

for i in range(K, N + 1):
    ans = 1
    for j in range(1, K + 1):
        ans *= A[i - j]
    l.append(ans)

for i in range(c - 1):
    if l[i] < l[i + 1]:
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

Solution code:
n, k = map(int, input().split())
a = list(map(int, input().split()))
mod = 10 ** 9 + 7
memo = []
for i in range(k,n+1):
    x = a[i-1] % mod
    for j in range(i-1, i-k, -1):
        y = a[j-1] % mod
        x *= y
    memo.append(x)

for test in range(1, len(memo)):
    if memo[test - 1] < memo[test]:
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

Solution code:
N, K = map(int, input().split())
A = list(map(int, input().split()))

sum_A = [0]*N
sum_A_k = 1
for i in range(K):
  sum_A_k = sum_A_k*A[i]
sum_A[K-1] = sum_A_k

for i in range(N-K):
  sum_A[K+i] = sum_A[K-1+i]*A[K+i]/A[i]
  if sum_A[K+i] > sum_A[K-1+i]:
    print('Yes')
  else:
    print('No')

Submission status: Time Limit Exceeded

Solution code:
a = list(map(int, input().split()))
b = list(map(int, input().split()))
N = a[0]
K = a[1]

k_1 = 1
k = 1

for i in range(N):
    if i < K:
        k *= b[i]
    else:
        k_1 = k
        k *= (b[i] / b[i-K])
        if k > k_1:
            print("Yes")
        else:
            print("No")

Submission status: Time Limit Exceeded

Solution code:
n,k=map(int,input().split())
A=list(map(int,input().split()))
lst=[1]*(n-k+1)
for i in range(n-k+1):
  if i==0:
    temp=1
    for j in range(k):
      if A[j]!=1:
        temp*=A[j]
    lst[i]=temp
  else:
    lst[i]=lst[i-1]*A[i+k-1]//A[i-1]
    print("Yes" if lst[i]>lst[i-1] else "No")

Submission status: Time Limit Exceeded

Solution code:
import numpy
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
A_front = A[0:K]
A_end = A[K::]
tmp_m = 1
for a in A:
    tmp_m = tmp_m * a
for i, a in enumerate(A_end):
    tmp_m_old = tmp_m
    tmp_m = (tmp_m // A[i]) * a
    if tmp_m_old < tmp_m:
        print('Yes')
    else:
        print('No')

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python

n, k = map(int, input().split())
a = list(map(int, input().split()))

inip = 1 
for i in range(k):
    inip *= a[i]

p = [inip]
tmp = inip

for i in range(k, n): 
    s = tmp//a[i-k]*a[i]
    p.append(s)
    tmp = s 

for i in range(len(p)-1):
    if p[i+1] > p[i]:
        print('Yes')
    else:
        print('No')

Submission status: Time Limit Exceeded

Solution code:
N, K = map(int, input().split())
A = list(map(int, input().split()))

point = [0] * (N - K + 1)

for i in range(N - K + 1):
    tmplist = A[i : i + K]
    tmppoint = tmplist[0]

    for j in range(1, K):
        tmppoint = tmppoint * tmplist[j]

    point[i] = tmppoint

k = 0
while k < (N - K):
    if point[k] < point[k + 1]:
        print("Yes")
    else:
        print("No")
    k = k + 1

Submission status: Time Limit Exceeded

Solution code:
N, K = map(int, input().split())
A = list(map(int, input().split()))
ans1 = 1
B = []
for i in range(K):
  ans1 = ans1*A[i]
B.append(ans1)
for i in range(N-K):
  ans1 = ans1*A[K+i]/A[i]
  B.append(ans1)
for i in range(N-K):
  if B[i] < B[i+1]:
    print('Yes')
  else:
    print('No')

Submission status: Time Limit Exceeded

Solution code:
#for _ in range(int(input())):
def zeroPad(numberString, zeros, left = True):
    """Return the string with zeros added to the left or right."""
    for i in range(zeros):
        if left:
            numberString = '0' + numberString
        else:
            numberString = numberString + '0'
    return numberString
def karatsubaMultiplication(x ,y):
    """Multiply two integers using Karatsuba's algorithm."""
    #convert to strings for easy access to digits
    x = str(x)
    y = str(y)
    #base case for recursion
    if len(x) == 1 and len(y) == 1:
        return int(x) * int(y)
    if len(x) < len(y):
        x = zeroPad(x, len(y) - len(x))
    elif len(y) < len(x):
        y = zeroPad(y, len(x) - len(y))
    n = len(x)
    j = n//2
    #for odd digit integers
    if (n % 2) != 0:
        j += 1    
    BZeroPadding = n - j
    AZeroPadding = BZeroPadding * 2
    a = int(x[:j])
    b = int(x[j:])
    c = int(y[:j])
    d = int(y[j:])
    #recursively calculate
    ac = karatsubaMultiplication(a, c)
    bd = karatsubaMultiplication(b, d)
    k = karatsubaMultiplication(a + b, c + d)
    A = int(zeroPad(str(ac), AZeroPadding, False))
    B = int(zeroPad(str(k - ac - bd), BZeroPadding, False))
    return A + B + bd
n,k=map(int,input().split())
x=[int(x) for x in input().split()]
ans=[1]*n
ans[0]=x[0]
for i in range(1,k):
  ans[i]=ans[i-1]*x[i]
c=0
for i in range(k,n):
  ans[i]=karatsubaMultiplication(ans[i-1]//x[c],x[i])
  if ans[i]>ans[i-1]:
    print('Yes')
  else:print('No')
  c+=1

Submission status: Time Limit Exceeded

Solution code:
n,k=input().split()
n=int(n)
k=int(k)
a=[int(x) for x in input().split()]
ans=1
for i in range(0,k):
    ans*=a[i]
prev=ans
for i in range(k,n):
    ans/=a[i-k]
    ans*=a[i]
    if(ans>prev):
        print("Yes")
    else:
        print("No")
    prev=ans

Submission status: Time Limit Exceeded

Solution code:
N,K=map(int,input().split())
A=list(map(int,input().split()))
AA=[]
point=1
for i in range(N-K+1):
    for j in range(K):
        point*=A[i+j]
    AA.append(point)
    point=1

for n in range(N-K):
    if AA[n]<AA[n+1]:
        print('Yes')
    elif AA[n]>=AA[n+1]:
        print('No')

Submission status: Time Limit Exceeded

Solution code:
from functools import reduce

n, k = map(int, input().split())
A = list(map(int, input().split()))


res = [0] * (n-k+1)
res[0] = reduce(lambda x, y: x*y , A[0:k+1])

for i in range(1, n-k+1):
    res[i] = res[i-1]//A[i-1]*A[i+k-1]
    print('Yes' if res[i-1] < res[i] else 'No')

Submission status: Time Limit Exceeded

Solution code:
from collections import deque
n, k = map(int, input().split())
a = list(map(int, input().split()))

prev = 1
for i in range(k):
    prev *= a[i]

a_old = deque(a)
a = deque(a[k:])
for i in range(k, n):
    score = prev*a.popleft() / a_old.popleft()
    if score <= prev:
        print('No')
    else:
        print('Yes')
    prev = score

Submission status: Time Limit Exceeded

Solution code:
import itertools
import math
import fractions
import functools
import copy
from collections import deque
from functools import reduce
from decimal import Decimal


def main():
    n, k = map(int, input().split())
    a = list(map(int, input().split()))
    sums = []
    amount = 1
    for i in range(0, k):
        amount = amount * a[i]
    sums.append(amount)

    for i in range(1, n-k+1):
        sums.append(sums[i-1]/a[i-1]*a[i+k-1])

    for i in range(1, n-k+1):
        if sums[i-1] < sums[i]:
            print("Yes")
        else:
            print("No")


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
n,k = map(int,input().split())
a = list(map(int,input().split()))
ans = [0]*(n+1)
ans[0] = 1
for i in range(k):
    ans[0] *= a[i]

for i in range(n-k):
    ans[i+1] = ans[i] * a[i+k] //a[i]
    if ans[i+1] > ans[i]:
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

Solution code:
N,K = (int(x) for x in input().split())
A = [int(x) for x in input().split()]

#print(N)
#print(K)
#print(A)

preX = -1
nowX = 1

for i in range(K,N+1):
#  print(str(i)+'学期')
  if i == K:
    for x in range(K):
      nowX *= A[x]
  else:
    nowX = int(preX / A[i-K-1] * A[i-1])
#    print(str(preX) +', '+ str(nowX))
    if preX < nowX:
      print('Yes')
    else:
      print('No')
  preX = nowX

Submission status: Time Limit Exceeded

Solution code:
n,k = map(int,input().split())
a = list(map(int,input().split()))

t = 0
for i in range(n-k+1):
    t_2 = 0
    if i == 0:
        for j in range(k):
            t += a[j+i]
        continue
    for j in range(k):
        t_2 += a[j+i]
    if t_2>t:
        print("Yes")
    else:
        print("No")
    t = t_2

Submission status: Time Limit Exceeded

Solution code:
n,k= list(map(int, input().strip().split()))
a = list(map(int, input().strip().split()))
b=[1]*n
for j in range(0,k):
        b[k-1]*=a[j]
for i in range(k+1,n+1):
    b[i-1]*=b[i-2]*a[i-1]//a[i-k-1]

    

for i in range(k,n):
    if b[i-1]<b[i]:
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

Solution code:
# cook your dish here

arr = []
n,k = (input().split())
arr = list(map(int, input().split()))
n = int(n)
k=int(k)
test = []
start =0
end = k
temp = 1
for j in range(k):
    temp = temp*arr[j]
test.append(temp)
for i in range(1,n-k+1):
    temp /= arr[start]
    temp *= arr[end]
    test.append(temp)
    if(test[i] <= test[i-1]):
        print("No")
    else:
        print("Yes")
    start+=1
    end+=1

Submission status: Time Limit Exceeded

Solution code:
N, K= map(int, input().split(' '))
A = list(map(int, input().split(' ')))
a = [0] * 200010

def N_score(n):
    Score = 1
    if(a[n - 1] == 0):
        for i in range(n - (K - 1), n + 1):
            Score *= A[i]
        return Score
    else:
        a[n] = a[n-1]/A[n-(K-1)-1]*A[n]


for i in range(K, N):
    if(N_score(i-1) < N_score(i)):
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

Solution code:
a = list(map(int, input().split()))
b = list(map(int, input().split()))

x = [1]*(a[0]-a[1]+1)

for i in range(a[1]-1,len(b)):
    for j in range(0,a[1]):
        x[i-(a[1]-1)] = x[i-a[1]+1]*b[i-j]

for i in range(1, len(x)):
    if int(x[i]) > int(x[i-1]):
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

Solution code:
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))

# print(a[4 - k: 4])

for i in range(1, n - k + 1):
    ii = k + i
    prev = ii - 1
    tmp = 1
    for x in a[ii - k: ii]:
        tmp = x * tmp

    prevTmp = 1
    for x in a[prev - k: prev]:
        prevTmp = x * prevTmp

    if prevTmp < tmp:
        print('Yes')
    else:
        print('No')

Submission status: Time Limit Exceeded

Solution code:
N,K = map(int, input().split())
a_arr = list(map(int, input().split()))

k_idx = K - 1
term_val_arr = []
ans_arr = []
for i in range(N - K + 1):
    val = 1
    for j in range(K):
        val *= a_arr[k_idx - j]
    term_val_arr.append(val)
    if i != 0:
        if term_val_arr[i - 1] < term_val_arr[i]:
            ans_arr.append('Yes')
        else:
            ans_arr.append('No')
    k_idx += 1
for i in ans_arr:
    print(i)

Submission status: Time Limit Exceeded

Solution code:
n,k = map(int, input().split())
a = list(map(int, input().split()))
ans = []
temp = 1
maxArr = n - k
for i in range(maxArr + 1):
  for j in range(k):
    temp *= a[j + i]
  ans.append(temp)
  temp = 1
  #print(ans)
  
for i in range(maxArr):
  #print(ans[i],ans[i+1])
  if(ans[i] < ans[i + 1]):
    print ('Yes')
  else:
    print('No')

Submission status: Time Limit Exceeded

Solution code:
from copy import deepcopy
n,k=map(int, input().split())
a=list(map(int,input().split()))
tmp = 1
for i in range(k):
    tmp*=a[i]
p = tmp
p //= a[0]
p *= a[k]
for j in range(n-k):
    #print(tmp,p)
    if tmp < p:
        print("Yes")
    else:
        print("No")
    if k+j+1 > n-1:
        break
    tmp = p
    #print(a[j+1],a[k+j])
    p //= a[j+1]
    p *= a[k+j+1]

Submission status: Time Limit Exceeded

Solution code:
N, K = map(int, input().split())
A = list(map(int, input().split()))


Eval = 1
for i in range(N):
    Eval = Eval*A[i]
    if (i >= K):
        Eval0 = Eval/A[i]
        Eval = Eval/A[i-K]
        if (Eval > Eval0):
            print('Yes')
        else:
            print('No')

Submission status: Time Limit Exceeded

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007

def calcSum(n, A):
    return n

def main():
    N, K = map(int, readline().split())
    A = list(map(int, readline().split()))

    l = [0] * (N + 1)
    for i in range(K, N + 1):
        pi = 1
        for j in range(i - K + 1, i + 1):
           pi *= A[j - 1]
        l[i] = pi
        if (i != K):
            if (l[i - 1] < l[i]):
                print("Yes")
            else:
                print("No")
    return


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8

N, K = list(map(int, input().split()))

As = list(map(int, input().split()))

# 1学期からK学期まで
v_0 = 1
for k in range(K):
    v_0 *= As[k]

for n in range(1, N - K + 1):
    v_1 = 1
    for k in range(K):
        v_1 *= As[n + k]

    if (v_1 > v_0):
        print('Yes')
    else:
        print('No')

    v_0 = v_1

Submission status: Time Limit Exceeded

Solution code:
a = list(map(int, input().split()))
b = list(map(int, input().split()))
N = a[0]
K = a[1]

k_1 = 1
k = 1

for i in range(N):
    if i < K:
        k = k * b[i]
    else:
        k_1 = k
        k = k * b[i] / b[i-K]
        if k > k_1:
            print("Yes")
        else:
            print("No")

Submission status: Time Limit Exceeded

Solution code:
N,K = map(int, input().split())
A = list(map(int, input().split()))
def prod(X,Y):
    Z = 0
    while Y > 0:
        if Y % 2 == 1:
            Z += X
        X <<= 1
        Y >>= 1
    return Z 
M = 1
for i in range (0,K):
    M = prod(M, A[i])
while True:
    def prod(X,Y):
        Z = 0
        while Y > 0:
            if Y % 2 == 1:
                Z += X
            X <<= 1
            Y >>= 1
        return Z 
    A.pop(0)
    if len(A) == K - 1:
        break
    P = 1
    for i in range (K):
        P = prod(P, A[i])
    print('Yes' if P > M else 'No')
    M = P

Submission status: Time Limit Exceeded

Solution code:
N,K = map(int,input().split())
A = list(map(int,input().split()))  
tempA = 1
for i in range(K):
  tempA *= A[i]

for i in range(N - K):
  mulA = tempA / A[i] * A[K+i]
  if tempA < mulA:
    print('Yes')
  else:
    print('No')
  tempA = mulA

Submission status: Time Limit Exceeded

Solution code:
n,k=map(int,input().split())
a=list(map(int,input().split()))
count=0
ans=None
d=0
for i in range(n-k+1):
  if d==0:
    s=a[count:k+count]
    gakki=1
    for w in s:
      gakki*=w
    d=1
  else:
    gakki/=a[count]
    gakki*=a[k+count]
    count+=1
  
  if ans is None:
    ans=gakki
  else:
    if ans<gakki:
      print('Yes')
      ans=gakki
    else:
      print("No")
      ans=gakki

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(N: int, K: int, A: "List[int]"):
    score = 1
    for i in range(K):
        score *= A[i]

    prev_score = score
    for i in range(N-K):
        score = score // A[i] * A[i+K]
        if score>prev_score:
            print(YES)
        else:
            print(NO)
        prev_score = score
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, K, A)

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
n, k = map(int, input().split())
a = list(map(int, input().split()))

previous_score = 1

for i in range(k):
    previous_score *= a[i] 

for j in range(k, n):
    score = previous_score * a[j] / a[j-k]

    if previous_score < score:
        print('Yes')
    else:
        print('No')

    previous_score = score

Submission status: Time Limit Exceeded

Solution code:

n,k = map(int, input().split())
a=list(map(int,input().split()))

hy=[1]*(n-k+1)
ans=0
for i in range(0,n-k+1):
    for e in range(0,k):
        hy[i]*=a[k-1+i-e]

for i in range(1,n-k+1):
    if hy[i-1]<hy[i]:
        ans='Yes'
        print(ans)
    else:
        ans='No'
        print(ans)
#print(hy)