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 functools
import operator
prod = functools.partial(functools.reduce, operator.mul)
listS = []

# N = 5 
# K = 3
# A = [96,98,95,100,20]

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

for i in range(0,N-K+1):
    listS.append(prod(A[i:K+i]))
    
for j in range(len(listS)-1):
    if listS[j] < listS[j+1]:
        print("Yes")
    else:
        print("No")

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:
N,K=map(int,input().split())
point = list(map(int, input().split()))

L = []
cnt = 1
for i in range(N-K+1):
    for j in range(K):
        cnt = cnt*point[j+i]
    L.append(cnt)
    cnt = 1

for k in range(N-K):
    if L[k] > L[k+1]:
        print("No")
    elif L[k] == L[k+1]:
        print("No")
    else:
        print("Yes")

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8
# Your code here!
# 幅優先探索（行きがけ）

import sys



def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())


def main():
    N, K = LI()
    Aarray = LI()

    start = 1
    for i in range(K):
        start *= Aarray[i]

    for i in range(K, N):
        a = i-K
        now = start*Aarray[i]/Aarray[a]
        if now > start:
            print("Yes")
        else:
            print("No")
        start = now


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
from functools import reduce

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

cum = [0] * (n - k + 1)
cum[0] = reduce(lambda x, y: x * y, a[0:0 + k])
for i in range(1, n - k + 1):
    cum[i] = cum[i - 1] * a[i + k - 1] // a[i - 1]

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

Submission status: Time Limit Exceeded

Solution code:
import sys, os, math, bisect, itertools, collections, heapq, queue, copy, array

# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
# from decimal import Decimal
# from collections import defaultdict, deque

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N, K = il()
    A = il()

    tmp = 0
    for k in range(K, N + 1):
        ret = 1
        for a in A[k - K:k]:
            ret *= a

        if tmp != 0 and tmp < ret:
            print('Yes')
        elif tmp != 0 and tmp >= ret:
            print('No')

        tmp = ret


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
import operator
from functools import reduce

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

first_idx = 0
last_idx = K

now_score = reduce(operator.mul, A[first_idx:last_idx])

while last_idx != N:
    next_score = now_score * A[last_idx] / A[first_idx]

    if next_score > now_score:
        print('Yes')
    else:
        print('No')

    first_idx += 1
    last_idx += 1

    now_score = next_score

Submission status: Time Limit Exceeded

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

Ki_sum1 = 1
 
for j in range(K):
    Ki_sum1 *= A[j]

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

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):
  a=1
  b=1
  for j in range(K):
    a=a*A[(i+j)]
    ##print(A[(i+j)],end=" ")
  ##print("")
  for j in range(K):
    b=b*A[(i+j+1)]
    ##print(A[(i+j+1)],end=" ")
  ##print("")
  ##print(a,b)
  if a<b:
    print("Yes")
  else:
    print("No")

Submission status: Time Limit Exceeded

Solution code:
line1 = input()
line2 = input()

n, k = tuple([int(val) for val in line1.split()])
a_list = [int(val) for val in line2.split()]

prev_sum = sum(a_list[0:k])
for i in range(k, n):
    current_sum = sum(a_list[i-k+1:i+1])
    if current_sum > prev_sum:
        print("Yes")
    else:
        print("No")
    prev_sum = current_sum

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:
from math import prod
n,k = map(int,input().split())
arr = list(map(int,input().split()))
j = 0
c = prod(arr[j:k])
for i in range(k,n):
    j += 1
    d = prod(arr[j:i+1])
    if d > c:
        print("Yes")
    else:
        print("No")
    c = d

Submission status: Time Limit Exceeded

Solution code:
n,k=map(int,input().split())
lst_1=list(map(int,input().split()))
# print(lst_1)
lst_2=[]
for i in range(n-k+1):
    temp=1
    for j in range(k):
        temp*=lst_1[i+j]
    lst_2.append(temp)
for i in range(len(lst_2)-1):
    if lst_2[i]<lst_2[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(' ')))
L = []
s = 0
while True:
  if len(A) < s + K:
    break
  su = 1
  for n in A[s:s + K]:
    su *= n
  L.append(su)
  if 1 < len(L):
    if L[s - 1] < L[s]:
      print('Yes')
    else:
      print('No')
  s += 1

Submission status: Time Limit Exceeded

Solution code:
import functools
import operator

n = functools.partial(functools.reduce, operator.mul)
N,K = map(int,input().split())
A = list(map(int,input().split()))
# print(n(A))
S = [0] * K
s = 0
for i in range(K,len(A)+ 1):
    # print(i)
    # S.append(n(A[(i-1)-(K-1):i]))
    # print(n(A[(i-1)-(K-1):i]))
    if i == K:
        s = n(A[(i-1)-(K-1):i])
        continue
    else:
        if s < n(A[(i-1)-(K-1):i]):
            print("Yes")
            s = n(A[(i-1)-(K-1):i])
        else:
            print("No")
            s = n(A[(i-1)-(K-1):i])

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import numpy as np

n,k= map(int,input().split())
a = list(map(int,input().split()))
target = a[0:k]
p = a[0]
for i in range(k-1):
    p *= a[i+1]
# print(p)
for i in range(n-k):
    ans = (p // a[i]) * a[i+k]
    # print(ans)
    if ans > p:
        print("Yes")
    else:
        print("No")
    p = ans

Submission status: Time Limit Exceeded

Solution code:
import numpy as np

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

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

stan = min(marks) - 1

marks = list(map(lambda x: x - stan, marks))

# print(marks)

scores = np.array([ np.array([marks[K+pivot-i-1] for i in range(K)]).prod() for pivot in range(N-K+1) ])

# print(scores)

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

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8
# Your code here!
# 幅優先探索（行きがけ）

import sys



def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())


def main():
    N, K = LI()
    Aarray = LI()

    start = 1
    for i in range(K):
        start *= Aarray[i]

    for i in range(K, N):
        now = start*Aarray[i]/Aarray[i-K]
        if now > start:
            print("Yes")
        else:
            print("No")
        start = now


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
import numpy as np

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

for i in range(N):
    a = A_l[i:i+K]
    b = A_l[i+1:i+K+1]
    if len(a) == K and len(b) == K:
        if np.prod(a) < np.prod(b):
            print('Yes')
        else:
            print('No')

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
import functools
import operator
import sys

def main():
    prod = functools.partial(functools.reduce, operator.mul)
    input = sys.stdin.readline
    n,k = map(int, input().split())
    a = list(map(int, input().split()))
    a_sum = [1]*n

    for i in range(0,n-k+1):
        a_sum[i] = prod(a[i:k+i])
        if i != 0:
            if a_sum[i] > a_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()))
for i in range(n-k):
  if sum(a[i:i+k]) < sum(a[i+1:i+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(' ')))
a = [0] * 200010

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


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

Submission status: Time Limit Exceeded

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


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

tests = A[: K]
score = reduce(mul, tests)
tests.pop(0)
for i in range(K, N):
    tests.append(A[i])
    this_term = reduce(mul, tests)
    if score < this_term:
        print("Yes")
    else:
        print("No")
    score = this_term
    tests.pop(0)

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

def hyoka(j,p,b_point):
  point = reduce(mul, A[j-k:j])
  if j == k:
    return point
  if b_point < point:
    print('Yes')
  else:
    print('No')
  return point
b_point = 0
for i,p in enumerate(A):
  if i+1 < k:
    continue
  result = hyoka(i+1,p,b_point)
  if result > 0:
  	b_point = result

Submission status: Time Limit Exceeded

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

l=[]
for i in range(n-k+1):
    total=1
    for j in range(0+i,k+i):
        total*=a[j]
    l.append(total)

for i in range(n-k):
    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()))
lscore = [0]*K
score = 1
for j in range(K):
    score *= A[j]
lscore.append(score)
for i in range(K+1,N+1):
        score = score*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())
x = list(map(int, input().split()))

for i in range(K+1, N+1):
  s = x[i-1]
  t = x[i-2]
  for j in range(1, K):
    s *= x[i-1-j]
    t *= x[i-2-j]
  if t<s:
    print("Yes")
  else:
    print("No")

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 = []

score = reduce(operator.mul, A_list[0: K])
score_list.append(score)

for g in range(K, N):
    score = score / A_list[g-K] * A_list[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:
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 // head) * a[i]
    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()))
point=[1]*(N+1)
M=N-K+1
for i in range(M):
    for j in range(K):
        point[K+i]=point[K+i]*A[j+i]
for i in range(M-1):
    if point[K+i]<point[K+i+1]:
        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]
        if i>=k:
            sum[i]/=a[i-k]
    
    # 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')

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


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

score = input().split()

result1 = 1
result2 = 1

for i in range(semester - K + 1) :
    if i == 0 :
        for j in range(K) :
            result1 = result1 * int(score[K - 1 - j])
        continue
    
    result2 = result1 // int(score[K - K + i - 1]) * int(score[K - 1 + i])
    

    if result1 < result2 :
        print("Yes")
    else :
        print("No")

    result1 = result2
    result2 = 1

Submission status: Time Limit Exceeded

Solution code:
n, k = map(int, input().split())
scs = list(map(int, input().split()))
#print(scs)
#res = []
re = 1
pre = 0

for i in range(n - k + 1):
    for j in range(k):
        re = re * scs[i + j]
    if pre < re and i != 0:
        print("Yes")
    elif i != 0:
        print("No")
    pre = re
    re = 1

Submission status: Time Limit Exceeded

Solution code:
N,K = map(int,input().split())
LIST =list(input().split())
b= K
a = 1
LIST1 = []
for i in range((N-K)+1):
    a = 1
    for j in range(i,b):
        a*=int(LIST[j])
    b+=1
    LIST1.append(a)
for k in range(N-K):
    if LIST1[k+1] > LIST1[k]:
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

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

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

#print(score_list)

for i in range(N-K):
  if score_list[i+1] > score_list[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]

c = []
bfr = 0
aft = 0
for i in range(k-1, n):
    aft = 0
    if bfr != 0:
        aft = (bfr / b[i - k]) * b[i] 
        if bfr < aft:
            c.append("Yes")
        else:
            c.append("No")
        bfr = aft
    else:
        bfr = 1
        for j in range(0, k):
            bfr *= b[j]
    
            
s_n = '\n'.join(c)
print(s_n)

Submission status: Time Limit Exceeded

Solution code:
n, k = map(int , input().split())
v = list(map(int, input().split()))
j = 1
prev = v[0]
prod = 1
for i in range(k) :
    prod *= v[i];

for i in range(k, n) :
    a = prod * v[i]
    a = a  // prev
    if a > prod :
        print("Yes")
    else :
        print("No")
    prod = prod // prev
    prod = prod * v[i]
    prev = v[j]
    j += 1

Submission status: Time Limit Exceeded

Solution code:
s = input().split()
N = int(s[0])
K = int(s[1])
A = input().split()

last = 0
for i in range(N):
    if i >= K:
        m1 = 1
        for j in range(K):
            m1 *= int(A[i - j - 1])
        m2 = 1
        for j in range(K):
            m2 *= int(A[i - j - 0])
        print('Yes' if m1 < m2 else 'No')

Submission status: Time Limit Exceeded

Solution code:
n, k = map(int, input().split())
a = [int(x) for x in input().split()]

result = [0]*n
tmp = 1
for i in range(k):
    tmp *= int(a[i])

result[k-1] =int(tmp)

for i in range(k, n):
    result[i] = int(int(result[i-1])*int(a[i])/int(a[i-k]))
    if result[i-1] < result[i]:
        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
    if len(term_val_arr) == 0:
        for j in range(K):
            val *= a_arr[k_idx - j]
        term_val_arr.append(val)
    else:
        term_val_arr.append(a_arr[k_idx] * term_val_arr[i - 1] / a_arr[i-1])

    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:
from sys import stdin


def readline_from_stdin() -> str:
    return stdin.readline().rstrip


if __name__ == '__main__':
    N, K, = input().split()
    A = [int(i) for i in input().split()]
    N, K = int(N), int(K)

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

    # scores = [score]
    # for i in range(N-K):
    #     print(i, K+i)
    #     score = int(score / A[i]) * A[K+i]
    #     scores.append(score)
    #
    # print(scores)
    #
    # results = [False for i in range(len(scores)-1)]
    #
    # for i in range(len(scores)-1):
    #     results[i] = scores[i+1] > scores[i]
    #
    # [print("Yes") if r else print("no") for r in results]

    for i in range(N-K):
        new_score = int(score / A[i]) * A[K+i]
        if new_score > score:
            print("Yes")
        else:
            print("No")
        score = new_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):
    if i + k >= n:
        exit()
    a = A[i:i+k]
    pre = a[0]
    aft = A[i+k]
    if pre >= aft:
        print('No')
    else:
        print('Yes')

Submission status: Time Limit Exceeded

Solution code:
import numpy as np

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

a = A

for i in range(K-1):
  A = np.roll(A, 1)
  a = np.multiply(a, A)

for j in range(K,N):
    if a[j-1] < a[j]:
        print('Yes')
    else:
        print('No')

Submission status: Time Limit Exceeded

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

latest_score = 0
before_score = 0

for cnt_k in range(k):
    if latest_score == 0:
        latest_score = a[cnt_k]
    else:
        latest_score *= a[cnt_k]

for cnt in range(1, n - k + 1):
    before_score = latest_score
    latest_score = 0
    for cnt_score in range(cnt, cnt + k):
        if latest_score == 0:
            latest_score = a[cnt_score]
        else:
            latest_score *= a[cnt_score]

    if before_score < latest_score:
        print('Yes')
    else:
        print('No')

Submission status: Time Limit Exceeded

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

d = []
for i in range(k, n+1):
  sp = 1
  for j in range(k):
    sp *= a[i-j-1]
  d.append(sp)

for i in range(n-k):
  if d[i] < d[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()))
memo = {}

tmp = 1
for i in range(k):
    tmp *= a[i]
memo[k-1] = tmp

for i in range(k,n):
    before = memo[i-1]
    after = 1
    for j in range(k):
        after *= a[i-j]
    
    if before < after:
        print("Yes")
    else:
        print("No")
    
    memo[i] = after

Submission status: Time Limit Exceeded

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

z = 0
c = 1
m = 0
for a in range(k-1,k):
    z = 0
    c = 1
    while z < k:
        c = c * arr[a-z]
        z += 1

    s.append(c)
    
lastkm1 = c//arr[m]

for i in range(k,n):
    m += 1
    c = lastkm1*arr[i]
    s.append(lastkm1*arr[i])
    lastkm1 = c//arr[m]

l = len(s)
for i in range(1,l):
    if s[i]>s[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()))
lscore = [0]*K
score = 1
for i in range(K,N+1):
    if i == K:
        for j in range(K):
            score *= A[j]
        lscore.append(score)
    else:
        score = score*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:
import operator
from functools import reduce

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

first_idx = 0
last_idx = K

a = A[first_idx:last_idx]
now_score = reduce(operator.mul, a)

while True:
    next_score = int((now_score * A[last_idx]) / A[first_idx])
    if next_score > now_score:
        print('Yes')
    else:
        print('No')

    first_idx += 1
    last_idx += 1

    if last_idx == N:
        exit()

    now_score = next_score

Submission status: Time Limit Exceeded

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

dp = [0] * (N+1)

for i in range(K,N+1):

    if i == K:
        temp = 1
        for j in range(K):
            temp *= A[i-1-j]
        dp[i] = temp
        continue

    dp[i] = int(dp[i-1] / A[i-1-K] * A[i-1])
    if i > K:
        if dp[i-1] < dp[i]:
            print('Yes')
        else:
            print('No')

Submission status: Time Limit Exceeded

Solution code:
n,k = map(int,input().split())
arr = list(map(int,input().split()))
prept = 0
pt = 0

for i in range(k-1,n):
    pt = arr[i]
    for j in range(1,k):
        pt *= arr[i-j]
    if i != k-1:
        if pt > prept:
            print("Yes")
        else:
            print("No")
        prept = pt
        continue
    else:
        prept = pt
        continue

Submission status: Time Limit Exceeded

Solution code:
import sys
from math import sqrt, gcd, ceil, log
from bisect import bisect, bisect_left
from collections import defaultdict, Counter, deque
from heapq import heapify, heappush, heappop
inp = sys.stdin.readline
read = lambda: list(map(int, inp().strip().split()))

def main():
	n, k = read(); arr = read()
	arr2 = [i for i in arr]
	for i in range(k-1):
		arr2[k-1] *= arr[i]
	# print(arr)
	for i in range(k, n):
		arr2[i] *= (arr2[i-1]//arr[i-k])
	# print(arr)
	# print(arr2)
	for i in range(k, n):
		print("YNeos"[arr2[i] <= arr2[i-1]::2])






if __name__ == "__main__":
	main()

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 = []

result = 1

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


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 = (int(x) for x in input().split())
A = [int(x) for x in input().split()]

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

preX = 0
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:
# vim: fileencoding=utf-8


def main():
    n, k = map(int, input().split())
    aList = list(map(int, input().split()))
    hyoukaList = []
    c = 1
    for i in aList:
        hyoukaList.append(i)
        b = hyoukaList[0]

        if c <= k:
            c += 1
            continue

        hyoukaList = hyoukaList[1:]
        if b < i:
            print("Yes")
        else:
            print("No")


if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

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

results = []

for i in range(K, N+1):
  next_score = 1
  if tmp == None:
    for p in points[i-K:i]:
      next_score *= p
  else:
    next_score = tmp / points[i-K-1] * points[i-1]
  tmp = next_score
  results.append(next_score)

#print(results)

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,raw_input().split(' '))
ar = list((map(int,raw_input().split(' '))))
pro = 1
for i in range(k):
  pro*=ar[i]

ans = []
ans.append(pro)

for i in range(k,n):
  pro//=ar[i-k]
  pro*=ar[i]
  ans.append(pro)

for i in range(len(ans)-1):
  if ans[i] < ans[i+1]:
    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()))
    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])
        if sums[i-1] < sums[i]:
            print("Yes")
        else:
            print("No")


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
from functools import reduce
N,K = map(int, input().split())
A = list(map(int, input().split()))
M = reduce((lambda X,Y: X*Y), A[:K])
while True:
    A.pop(0)
    if len(A) == K - 1:
        break
    P = reduce((lambda X,Y: X*Y), A[:K])
    print('Yes' if P > M else 'No')
    M = P

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
# import decimal
import time
time1 = time.time()

N, K = map(int, input().split())
# N = 200000
# K = 50000
A_list = list(map(int, input().split()))
# A_list = [2 for i in range(N)]
Score_list = [1 for i in range(N+1)]

for i in range(K, N+1):
    if i == K:
        S = 1
        for j in range(i-K, i):
            S *= A_list[j]
        Score_list[i] = S
    else:
        Score_list[i] = int(Score_list[i-1] / A_list[i-1-K])
        Score_list[i] *= A_list[i-1]
    if i > K:
        if Score_list[i] > Score_list[i-1]:
            print("Yes")
        else:
            print("No")
    # print(Score_list)

# print(Score_list)
time2 = time.time()
# print(time2-time1)

Submission status: Time Limit Exceeded

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

for i in range(1,N-K+1):
    for j in range(K):
        point*=A[i+j]
    AA[i]=point
    
    if AA[i-1]<AA[i]:
        print('Yes')
    elif AA[i-1]>=AA[i]:
        print('No') 

    point=1

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 = sum(data[count:count+num[1]])
        kyouka_af = sum(data[count+1:count+num[1]+1])
        
        if kyouka_be >= kyouka_af:
            print('No')
            
        else:
            print('Yes')

        count = count + 1

if __name__ == '__main__':
    Marks()