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:
import math
import collections
import fractions
import itertools
import functools
import operator

def solve():
    n, k = map(int, input().split())
    a = list(map(int, input().split()))
    ruiseki = [1]
    ruiseki2 = []
    for i in range(1, n+1):
        ruiseki.append(a[i-1]*ruiseki[i-1])
    for i in range(k-1, n):
        ruiseki2.append(ruiseki[i+1]//ruiseki[i-k+1])
    for i in range(n-k):
        if ruiseki2[i] < ruiseki2[i+1]:
            print("Yes")
        else:
            print("No")
    return 0

if __name__ == "__main__":
    solve()

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:i]) for i in range(N+1) if i >= K]
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:
import sys, math, itertools, collections, bisect 
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') 
inf = float('inf') ;mod = 10**9+7 
mans = inf ;ans = 0 ;count = 0 ;pro = 1

import sys, math, itertools, collections, bisect 
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') 
inf = float('inf') ;mod = 10**9+7 
mans = inf ;ans = 0 ;count = 0 ;pro = 1
 
n, k = map(int, input().split())
A = list(map(int, input().split()))
for i in range(k-1, n):
    #print(A[i])
    if i == k-1:
        now = 1
        for j in range(k):
            now *= A[i-j]
        before = now
    else:
        now = now//A[i-k]
        now *= A[i]
        #print(A[i-k], A[i], now, before)
        if before < now:
            print("Yes")
        else:
            print("No")
        before = now

Submission status: Time Limit Exceeded

Solution code:
N,K=map(int,input().split())
A=list(map(int,input().split()))
hyouten=[0]*(N+5)

for i in range(K+1,N+1):
    for j in range(i-K,i):
        if hyouten[i]==0:
            hyouten[i]=A[j]
        else:
            hyouten[i]*=A[j]
    prevhyouten=hyouten[i]/A[i-1]*A[i-K-1]
    if hyouten[i] > prevhyouten:
        # print(prevhyouten,hyouten[i])
        print("Yes")
    else:
        # print(prevhyouten,hyouten[i])
        print("No")

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

result = 1

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

for i in range(k, n):
    before_result = result
    result /= a[i - k]
    result *= a[i]
    if before_result < result:
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

Solution code:
n, k = map(int, input().rstrip().split())
arr = list(map(int, list(input().split())))
tmp = -1
for i in range(k,n+1):
  ar_ = arr[i-k:i]
  ar = 1
  for a in ar_:
    ar *= a
  if tmp != -1:
    if ar > tmp:
      print("Yes")
    else:
      print("No")
  tmp = ar

Submission status: Time Limit Exceeded

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

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

score = [0]*N
dq = []

score_now = 1
for i in range(0, K):
    score_now *= A[i]
left = A[0]
index = 0

for j in range(K-1, N-1):
    score[j] = score_now

    score_now /= left
    index += 1
    left = A[index]
    score_now *= A[j+1]
score[N-1] = score_now


for k in range(K, N):
    if score[k] > score[k-1]:
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

Solution code:
# m-solutions2020_c.py
# https://atcoder.jp/contests/m-solutions2020 : C

global FLAG_LOG
FLAG_LOG = False


def log(value):
    # FLAG_LOG = True
    FLAG_LOG = False
    if FLAG_LOG:
        print(str(value))


def calculation(lines):
    # K = lines[1]
    # K = int(lines[1])
    N, K = list(map(int, lines[0].split()))
    values = list(map(int, lines[1].split()))
    # values = list(map(int, lines[2].split()))
    # values = list()
    # for i in range(N):
    #     values.append(int(lines[i]))
    # valueses = list()
    # for i in range(N):
    #     valueses.append(list(map(int, lines[i+1].split())))

    marks = list()

    for i in range(N-K+1):
        targets = values[i:i+K]
        log(f'targets=[{targets}]')
        mark = 1
        for target in targets:
            mark *= target
        marks.append(mark)

    log(f'marks=[{marks}]')

    rets = list()
    prev = None
    for mark in marks:
        if prev is None:
            prev = mark
        else:
            if prev < mark:
                rets.append('Yes')
            else:
                rets.append('No')
            prev = mark

    return rets


# 引数を取得
def get_input_lines(lines_count):
    lines = list()
    for _ in range(lines_count):
        lines.append(input())
    return lines


# テストデータ
def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['5 3', '96 98 95 100 20']
        lines_export = ['Yes', 'No']
    if pattern == 2:
        lines_input = ['3 2', '1001 869120 1001']
        lines_export = ['No']
    if pattern == 3:
        lines_input = ['15 7', '3 1 4 1 5 9 2 6 5 3 5 8 9 7 9']
        lines_export = ['Yes', 'Yes', 'No', 'Yes', 'Yes', 'No', 'Yes', 'Yes']
    return lines_input, lines_export


# 動作モード判別
def get_mode():
    import sys
    args = sys.argv
    global FLAG_LOG
    if len(args) == 1:
        mode = 0
        FLAG_LOG = False
    else:
        mode = int(args[1])
        FLAG_LOG = True
    return mode


# 主処理
def main():
    import time
    started = time.time()
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines(2)
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    if mode > 0:
        log(f'lines_input=[{lines_input}]')
        log(f'lines_export=[{lines_export}]')
        log(f'lines_result=[{lines_result}]')
        if lines_result == lines_export:
            log('OK')
        else:
            log('NG')
    finished = time.time()
    duration = finished - started
    log(f'duration=[{duration}]')


# 起動処理
if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

n = 1
c = 0

for j in A[:K]:
    n *= j

for i in range(K,N):
    tmp = n
    tmp /= A[c]
    tmp *= A[i]

    if tmp > n:
        print("Yes")
    else:
        print("No")

    c += 1

Submission status: Time Limit Exceeded

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

k = 1
k_1 = 1

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
def main():
    N, K = map(int, input().split())
    As = list(map(int, input().split()))
    hyouka = [0]*(N-K+1)
    kekka = 1
    for i in range(N-K+1):
        if i == 0:
            for j in As[i:i+K]:
                kekka *= j
                hyouka[i]=kekka
        else:
            kekka = kekka/As[i-1]*As[i+K-1]
            hyouka[i]=int(kekka)
    #print(hyouka)
    for j in range(len(hyouka)):
        if j>0:
            if hyouka[j] > hyouka[j-1]:
                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()))


for i in range(N-K):
  Ki_sum1 = 1
  Ki_sum2 = 1
  for j in range(i,K+i):
    Ki_sum1 *= A[j]
  
  for j in range(i+1,K+i+1):
    Ki_sum2 *= A[j]
  
  if Ki_sum1 < Ki_sum2:
    print("Yes")
  else:
    print("No")

Submission status: Time Limit Exceeded

Solution code:
import sys
def input():
    return sys.stdin.readline()[:-1]

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

    sum=[0]*n
    sum[0]=a[0]
    for i in range(1,n):
        sum[i]=sum[i-1]*a[i]
        p=[0]*n
    for i in range(k-1,n):
        if i==k-1:
            p[i]=sum[i]
        else:
            p[i]=sum[i]/sum[i-k]


    for i in range(k,n):
        if p[i]>p[i-1]:
            print('Yes')
        else:
            print('No')


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

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

    point = [1] * (N)
    point[0] = A[0]

    for i in range(1, N):
        point[i] = point[i - 1] * A[i]

    ans = point[K - 1]
    for i in range(N - K):
        tmp = point[K + i] / point[i]
        if ans < tmp:
            print('Yes')
        else:
            print('No')
        ans = tmp


if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

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

for i in range(n-k+1):
  m = 1
  for j in range(k):
    m *= a[j]
  s.append(m)
  a.pop(0)

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

Submission status: Time Limit Exceeded

Solution code:
N, K = map(int, input().split())
l = []
i = 0
for x in input().split():
    A = int(x)
    l.append(A)
    if i >= K:
        if l.pop(0) < A:
            print("Yes")
        else:
            print("No")
    i = i + 1

Submission status: Time Limit Exceeded

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

pi=[]
s=1
for i in range(k):
  s*=a[i]
pi.append(s)

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

for i in range(n-k):
  if pi[i+1]>pi[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()))


ans = [0]*(n-k+1)
count = 0
for i in range(n-k+1):
    ans[i] =a[i]
    for j in range(k-1):
        ans[i] = ans[i] * a[i+j+1]
    
    if count > 0:
        if ans[i-1]  < ans[i]:
            print('Yes')
        else:
            print('No')
    count = count + 1

Submission status: Time Limit Exceeded

Solution code:
n,k=map(int,input().split())
l=list(map(int, input().split()))
res=[]
for i in range(k-1,n):
    a=1
    li=l[i-k+1:i+1]
    for j in li:
        a*=j
    res += [a]
for j in range(1,len(res)):
    print("Yes" if res[j]>res[j-1] else "No")

Submission status: Time Limit Exceeded

Solution code:
import copy
N, K = map(int, input().split())
a = list(map(int, input().split()))
b = copy.deepcopy(a)
for i in range(K-1, N, 1):
  for j in range(1, K):
    b[i] *= a[i-j]
  if i >= K and b[i] > b[i-1]:
    print("Yes")
  if i >= K and b[i] <= b[i-1]:
    print("No")

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]
for i in range(k-1, n-1):
    if int(score) < int(score*a[i+1]/a[i-k+1]):
        print('Yes')
    else:
        print('No')
    score = score*a[i+1]/a[i-k+1]

Submission status: Time Limit Exceeded

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

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

    point = [1] * (N)
    point[0] = A[0]

    for i in range(1, N):
        point[i] = point[i - 1] * A[i]

    ans = point[K - 1]
    for i in range(N - K):
        tmp = point[K + i] / point[i]
        if ans < tmp:
            print('Yes')
        else:
            print('No')
        ans = tmp


if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
n,k = map(int,input().split())
a = list(map(int,input().split()))
b = [0]*(n+1)
t = 0
for i in range(k,n+1):
    if i == k:
        x = 1
        for aj in a[i-k:i]:
            x *= aj
            b[i] = x
        t = x
        continue
    else:
        x = b[i-1]/a[i-k-1]*a[i-1]
        #x = 
        if t < x:
            print("Yes")
        else:
            print("No")
        b[i] = x
        t = x
#print(b)

Submission status: Time Limit Exceeded

Solution code:
N, K = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
a2 = [1]

for i in a:a2.append(a2[-1]*i)


score_dict = {K:a2[K]}

for i in range(K+1, N+1):
    score_dict[i] = a2[i]//a2[i-K]
    if score_dict[i] > score_dict[i-1]:
        print('Yes')
    else:
        print('No')

Submission status: Time Limit Exceeded

Solution code:
nk = input('')
n = int(nk.split()[0])
k = int(nk.split()[1])

alist = list(map(int,input('').split()))

pre=0
result=1
for i in range(n-k+1):
    record=""
    if i==0:
        for j in range(k):
            result *= alist[j+i]
    else:
        result=result * alist[i+k-1] / alist[i-1]
#    print("[{}/{}]:{}".format(i,i+k,result))
    if i>0:
        if result > pre:
            print('Yes')
        else:
            print('No')
    pre=result

Submission status: Time Limit Exceeded

Solution code:
N,K = map(int, input().split())
A = list(map(int, input().split()))
M = 1
for i in range (0,K):
    M *= A[i]
while True:
    A.pop(0)
    if len(A) == K - 1:
        break
    P = 1
    for i in range (0,K):
        P *= A[i]
        if P > M:
            break
    print('Yes' if P > M else 'No')
    M = P

Submission status: Time Limit Exceeded

Solution code:
import functools
import operator

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

prod = functools.partial(functools.reduce, operator.mul)
for c, i in enumerate(range(K, N+1)):
    sum_prod = prod(A[i-K:i])
    if i > K:
        if sum_prod > tmp_sum_prod:
            print('Yes')
        else:
            print('No')
    tmp_sum_prod = sum_prod

Submission status: Time Limit Exceeded

Solution code:
import sys
input=sys.stdin.readline

def mult(x, y):
    z = 0
    while y > 0:
        if y % 2 == 1: z = z + x
        x = x << 1
        y = y >> 1
    return z
n,k=map(int,input().split())
a=list(map(int,input().split()))
b=[]
p=1
for i in range(n):
    p=mult(p,a[i])

    if i>=k-1:
        b.append(p)
        p=p//a[i-k+1]

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

Submission status: Time Limit Exceeded

Solution code:
#Problem C

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

p1 = 1
p2 = 0


for i in range(K):
    p1 *= a[i]
    

for i in range(N-K):
    p2 = p1/a[i]*a[K+i]
    if p2 > p1:
        print("Yes")
    else:
        print("No")
    p1 = p2

Submission status: Time Limit Exceeded

Solution code:
tmp=[int(i) for i in input().split(' ')]
tmp_s=[int(i) for i in input().split(' ')]
score=[]
leng=tmp[0]-tmp[1]+1
for i in range(leng):
  t=1
  for j in range(tmp[1]):
    t=t*int(tmp_s[j+i])
  score.append(t)
for i in range(len(score)-1):
  if score[i]<score[i+1]:
    print('Yes')
  else:
    print('No')

Submission status: Time Limit Exceeded

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

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 //= A[i]
        score *= 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:
import numpy as np

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

before = 1

for i in range(K):
    before *= A[i]

for i in range(K, N):
    after = before // A[i-K]
    after *= A[i]

    if after > before:
        print('Yes')
    else:
        print('No')

    before = after

Submission status: Time Limit Exceeded

Solution code:
n,k = map(int, input().split())
a = list(map(int, input().split()))
prod = 1
l = 0
for i,j in enumerate(a):
  if i>=k:
    pre = prod
    prod *= j
    prod //= a[l]
    l += 1
    if prod>pre:
      print('Yes')
    else:
      print('No')
  else:
    prod *= j

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()))

def prod(A):
    ans = A[0]
    for i in range(1,len(A)):
        ans = ans * A[i]
    return ans

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

pre = prod(scores)

while i < N:
    cur = pre
    cur = cur / scores[i % K]
    cur = cur * A[i]
    scores[i % K] = A[i]

    if cur > pre:
        print(YES)
    else:
        print(NO)
    pre = cur
    i += 1

Submission status: Time Limit Exceeded

Solution code:
import sys


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

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

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

Submission status: Time Limit Exceeded

Solution code:
#C
N, K = map(int, input().split())
A = list(map(int, input().split()))
p=[]
ans=1
for j in range(K):
    ans=ans*A[j]

for i in range(N-K+1):
    if i==0:
        p.append(ans)
        continue
    else:
        ans=ans*A[i+K-1]/A[i-1]
    p.append(ans)

for j in range(len(p)-1):
    if p[j]<p[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()))
sum = 1
last = 1
sw = 0
for num in range(K):
  last *= A[num]
for i in range(1,N-K+1):
  for j in range(K):
    sum *= A[i+j]
    if last < sum:
      print("Yes")
      sw = 1
      break
  if sw ==0:
    print("No")
  last = sum
  sum = 1
  sw = 0

Submission status: Time Limit Exceeded

Solution code:
N, K = map(int, input().split())
A = [int(x) for x in input().split()]
list_score = [1]*(N-K+1)
for i in range(len(list_score)):
  for j in range(K):
    list_score[i] *=A[i+j]
    
for i in range(1, len(list_score)):
  if list_score[i] > list_score[i-1]:
    print('Yes')
  else:
    print('No')

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/python
# -*- coding: UTF-8 -*-

import sys


def get_ints():
    return map(int, sys.stdin.readline().strip().split())


def std_in():
    return sys.stdin.readline().strip()


def calc_score(a, f, e):
    score = 1

    for i in range(f, e):
        score *= a[i]
    return score


def main():
    n, k = get_ints()
    a = list(get_ints())

    score = calc_score(a, 0, k)

    for i in range(k, n):
        if a[i-k] == 0:
            n_score = calc_score(a, i-k+1, i+1)
        else:
            n_score = int(score / a[i-k] * a[i])

        if n_score > score:
            print("Yes")
        else:
            print("No")
        score = n_score


if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
#for _ in range(int(input())):
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]=(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 = map(int, input().split())
A = list(map(int, input().split()))
ls = [1] * (N+10)
for i in range(K):
    ls[K-1] *= A[i]
for i in range(K, N):
    ls[i] = ls[i-1]//A[i-K] * A[i]
    if ls[i] > ls[i-1]:
        print('Yes')
    else:
        print('No')

Submission status: Time Limit Exceeded

Solution code:
import operator
import functools

def main():
    N,K = map(int,input().split())
    A = list(map(int,input().split()))
    p  = 0

    for i in range(K-1,N):
        lst= A[i-K+1:i+1]
        #p = mul(lst)
        p = functools.reduce(operator.mul,lst)
        if i != K-1:
            if p <= prev:
                print('No')
            else:
                print('Yes')
        prev = p
    
if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
n , k =map(int, input().split())
a = list(map(int, input().split()))
a_mul = [0] * n
mul = 1
for i in range(n):
    if i < k:
        mul *= a[i]
    else:
        mul = mul * a[i] // a[i - k]
    a_mul[i] = mul

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

Submission status: Time Limit Exceeded

Solution code:

def main():
    n,k = map(int, input().split())
    a = list(map(int, input().split()))
    sum = [1]*n
    b = 0

    for i in range(0,n+1-k):
        for ii in range(k):
            sum[i] = sum[i]*a[ii+b]
        b += 1
        if i != 0:
            if sum[i] > sum[i-1]:
                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()))
x = 1
for i in range(k):
    x *= a[i]
ls = [x]
for j in range(1,n-k+1):
    x /= a[j-1]
    x *= a[j+k-1]
    ls.append(int(x))
for i in range(1,len(ls)):
    if ls[i] > ls[i-1]:
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

Solution code:
n, k = map(int, input().split())
A = [*map(int, input().split())]
# print(n,k)
# print(A)

pre = 1
for i in range(k):
    pre *= A[i]


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

Submission status: Time Limit Exceeded

Solution code:
N,K=map(int,input().split())
a=input().split()
A=[int(i) for i in a]
#print(N,K)
#print(A)

for i in range(N-K):
  be_score=1
  score=1
  for j in range(K):
    be_score*=A[i+j]
    score*=A[i+j+1]
    #print(be_score,score)
  if(be_score<score):
    print('Yes')
  else:
    print('No')

Submission status: Time Limit Exceeded

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

for i in range(1,N-K+1): 
    if terms[i] > terms[i-1]: 
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

Solution code:
n,k=(input().split())
a=list(map(int,input().split()))
pdt=a
p=1
for i in range(int(n)):
  p*=a[i]
  pdt[i]=p
j=0  
for i in range(int(k),int(n)):
  a[i]=pdt[i]/a[j]
  #print(a[i],a[j],a[i-1])
  j+=1
  if(a[i]>a[i-1]):
    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()]
before = 1
for i in range(K):
    before *= A[i]
val = 0
for i in range(K,len(A)):
    val = before
    val = val / A[i-K] * A[i]

    if(val > before):
        print("Yes")
    else:
        print("No")
    before = val

Submission status: Time Limit Exceeded

Solution code:
n, k = map(int, input().split())
a = list(map(int, input().split()))
ans = ["Yes"]*(n-k)
s = []

for i in range(n-k+1):
  m = 1
  for j in range(k):
    m *= a[j]
  s.append(m)
  a.pop(0)

for i in range(n-k):
  if s[i] >= s[i+1]:
    ans[i] = "No"

for i in range(len(ans)):
    print(ans[i])

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):
    be = A[i:i+K]
    af = A[i+1:i+K+1]
    if sum(be) < sum(af) :
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

Solution code:

def main():
    n, k = map(int, input().split())
    a = list(map(int, input().split()))
    ans = 1

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

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


main()

Submission status: Time Limit Exceeded

Solution code:

def solve(n, k, arr, temp):
    size = k
    t = temp
    for i in range(k, n):
        t  = temp // arr[i-k]
        t *= arr[i]
        if t > temp:
            print('Yes')
        else:
            print('No')

        temp = t




def main():
    [n, k] = [int(x) for x in input().split()]
    arr = [int(x) for x in input().split()]

    temp = 1
    for i in range(k):
        temp *= arr[i]

    solve(n, k, arr, temp)


main()

Submission status: Time Limit Exceeded

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

base = 1

for ai in A[:K+1]:
  base *= ai

score = [base]

for i in range(K+1, N+1):
  s = score[-1] // A[i-K] * A[i]
  score.append(s)

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

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sat Jul 25 17:57:31 2020

@author: Paras
"""

n,k = map(int, input().split())
marks = list(map(int, input().split()))
score_curr = 1
for i in range(k):
  score_curr*=marks[i]
  
f = marks[0]
score_prev = score_curr
j = 0
for i in range(k,n):
    score_curr = (score_prev//f)*marks[i]
    if score_curr>score_prev:
        print("Yes")
    else:
        print("No")
    score_prev = score_curr
    j+=1
    f = marks[j]

Submission status: Time Limit Exceeded

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

test = [1]*(n-k+1)

for i in range(n-k+1):
  for j in range(k):
    test[i] *= a[i+j]

  if i > 0:
    if test[i-1] < test[i]:
      print("Yes")
    else:
      print("No")

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8
import sys
#from operator import itemgetter
sysread = sys.stdin.buffer.readline
read = sys.stdin.buffer.read
#from heapq import heappop, heappush
from collections import defaultdict
sys.setrecursionlimit(10**7)
import math
#from itertools import product, accumulate, combinations, product
#import bisect# lower_bound etc
#import numpy as np
#from copy import deepcopy
#from collections import deque


def run():
    N, K, *A = map(int, read().split())
    A = [-1] + A
    INF = 1 << 50
    X = [INF, 1, 1]
    for i, a in enumerate(A[1:], 1):
        pre = X[1]
        if i <= K:
            if a == 0:
                X[0] = i
                X[1] = 0
                X[2] = 1
                continue

            X[1] *= a
            X[2] *= a
        if i > K:
            if a == 0:
                X[0] = i
                X[1] = 0
                X[2] = 1
                continue
            if i - K == X[0]:
                X[0] = INF
                X[1] = X[2]
            elif A[i-K] == 0:
                pass
            else:
                X[1] /= A[i-K]
            X[1] *= a
            X[2] *= a
            if pre < X[1]:
                print('Yes')
            else:
                print('No')


if __name__ == "__main__":
    run()

Submission status: Time Limit Exceeded

Solution code:
def inN():
    return int(input())
def inL():
    return list(map(int,input().split()))

n,k = inL()
a = inL()
sum = 1
sum2 = 1
for i in range(k):
    sum2 *= a[i]
for i in range(k,n):
    #print(sum2)
    sum = sum2 * a[i] / a[i-k] 
    if sum > sum2:
        print('Yes')
    else:
        print('No')
    sum2 = sum

Submission status: Time Limit Exceeded

Solution code:
# 2020/07/25
# M-SOLUTIONS プロコンオープン 2020 - C

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

# Calc
pt = a[0]
km1 = k - 1

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

for i in range(k, n):
    bef_pt = pt
    pt = pt / a[i-k] * a[i]

    # Output
    if bef_pt < pt:
        print('Yes')
    else:
        print('No')

Submission status: Time Limit Exceeded

Solution code:
N,K = map(int,input().split())
A = list(map(int, input().split()))
kake = []
sum = 1
for i in range(0,N-K+1):
  for j in range(K):
  	sum *= A[i+j]
  kake += [sum]
  sum = 1
for num in range(len(kake)-1):
  if kake[num] < kake[num+1]:
    print("Yes")
  else:
    print("No")