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:
#!/usr/bin/env python3
import collections as cl
import sys


def II():
    return int(sys.stdin.readline())


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


def LI():
    return list(map(int, sys.stdin.readline().split()))


def main():
    n, k = MI()
    scores = LI()

    score_now = 1

    for i in range(k):
        score_now *= scores[i]

    for i in range(k, n):
        next_score = score_now * (scores[i] / scores[i - k])
        print("Yes" if next_score > score_now else "No")


main()

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

Submission status: Time Limit Exceeded

Solution code:
def listseki(A,start,end):
    ans=1
    for i in range(start,end+1):
        ans*=A[i]
    return ans
N,K=map(int,input().split())
A=list(map(int,input().split()))
oldseki=listseki(A,0,K-1)
for i in range(1,N-K+1):
    nowseki=listseki(A,i,i+K-1)
    if nowseki>oldseki:
        print("Yes")
    else:
        print("No")
    oldseki=nowseki

Submission status: Time Limit Exceeded

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

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

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

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]

hyo = [0]*N
hyo[K-1] = x

for i in range(K, N):
    hyo[i] = hyo[i-1]//A[i-K]*A[i]
    if hyo[i] > hyo[i-1]:
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**8)
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return [LIST() for _ in range(n)]
def NSTR(n): return [input() for _ in range(n)]


INF = float("inf")
MOD = 10**9 + 7


def main():
    N, K = MAP()
    A = LIST()

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

    # print(prods)
    for i in range(N-K):
        if prods[i] < prods[i+1]:
            print("Yes")
        else:
            print("No")
    return


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

score_i = 1
for a_i in A[:K]:
    score_i *= a_i

for i in range(K, N):
    new_score_i = A[i] * score_i // A[i - K]
    if score_i < new_score_i:
        print('Yes')
    else:
        print('No')
    score_i = new_score_i

Submission status: Time Limit Exceeded

Solution code:
import collections
n,k = map(int , raw_input().split())

q = collections.deque([])
cumul = 1
prev = 0
for ai in map(int, raw_input().split()):
	cumul *= ai
	q.append(ai)
	if len(q) == k + 1:
		cumul /= q.popleft()


	if len(q) == k:
		if prev != 0:
			print 'Yes' if cumul > prev else 'No'
		prev = cumul

Submission status: Time Limit Exceeded

Solution code:
import os
import sys
from io import BytesIO, IOBase
from collections import defaultdict as dd

def main():
    n,k=map(int,input().split())
    ar=list(map(int,input().split()))
    prod=1
    for i in range(k):
        prod*=ar[i]
    for i in range(k,n):
        x=prod*ar[i]//ar[i-k]
        if x>prod:
            print('Yes')
        else:
            print('No')
        prod=x




BUFSIZE = 8192
class FastIO(IOBase):
    newlines = 0
    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")


if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
# Author: S Mahesh Raju
# Username: maheshraju2020
# Date: 25/07/2020

from sys import stdin,stdout
from math import gcd, ceil, sqrt
from collections import Counter
from bisect import bisect_left, bisect_right
ii1 = lambda: int(stdin.readline().strip())
is1 = lambda: stdin.readline().strip()
iia = lambda: list(map(int, stdin.readline().strip().split()))
isa = lambda: stdin.readline().strip().split()
mod = 1000000007

n, k = iia()
arr = iia()
tot = 1
for i in range(k):
    tot *= arr[i]

for i in range(k, n):
    cur = tot
    tot *= arr[i]
    tot //= arr[i - k]
    if tot > cur:
        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()))


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

    score = nscore

Submission status: Time Limit Exceeded

Solution code:
from sys import stdin
N,K = [int(x) for x in stdin.readline().rstrip().split()]
A = [int(x) for x in stdin.readline().rstrip().split()]

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

for i in range(K,N):
    tmp = score
    score *= A[i]
    score //= A[i-K]
    if score > tmp:
        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=[0]*(n+1)
b[0]=1
for i in range(1,n+1):
  b[i] = b[i-1] * a[i-1]
  if i < k+1:
    continue
  b[i] = b[i] // a[i-k-1]
  if b[i] > b[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()))
s=1
for i in range(K):
  s*=A[i]
l,r=0,K
for i in range(N-K):
  ne=s*A[r]//A[l]
  if ne>s:
    print('Yes')
  else:
    print('No')
  l+=1
  r+=1
  s=ne

Submission status: Time Limit Exceeded

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

tmp = 1
for i in range(K):
    tmp *= A[i]
tmp1 = tmp
idx = 0
for i in range(K, N):
    tmp1 *= A[i]
    tmp1 = tmp1//A[idx]
    if(tmp1 > tmp):
        print("Yes")
        tmp = tmp1
        idx += 1
    else:
        print("No")
        tmp = tmp1
        idx += 1

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]
top = 0
for i in range(k, n):
    pre_score = score
    score /= a[top]
    top += 1
    score *= a[i]
    if score > pre_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()))
tmp=1
for i in range(k):
    tmp*=a[i]
for i in range(n-k):
    tmp1=tmp//a[i]*a[i+k]
    if tmp1>tmp:
        print("Yes")
        tmp=tmp1
    else:
        print("No")
        tmp=tmp1

Submission status: Time Limit Exceeded

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

for k in range(K):
  P*=A[k]
B+=[P]

for n in range(N-K):
  P = P/A[n]*A[n+K]
  B+=[P]
  
  if B[n]<B[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()))
ans = [0] * (N)
temp = 1
for i in range(K):
    temp *= A[i]
ans[K - 1] = temp
for i in range(K, N):
    ans[i] = ans[i - 1] * A[i] // A[i - K]
    if ans[i] > ans[i - 1]:
        print('Yes')
    else:
        print('No')

Submission status: Time Limit Exceeded

Solution code:
def prod(X):
    val = 1
    for x in X:
        val = val * x
    return val

N, K = map(int, input().split())
A = list(map(int, input().split()))
G = [prod(A[:K])]
for i in range(K, N):
    val = G[-1] // A[i - K] * A[i]
    G.append(val)
# print(G)

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

Submission status: Time Limit Exceeded

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

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

p1=0
p2=k

last=p
for i in range(k,n):
    p = p//a[p1]
    p*=a[p2]
    p1+=1
    p2+=1
    if p>last:
        print('Yes')
    else:
        print('No')
    last=p

Submission status: Time Limit Exceeded

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

t = 1
for i in range(K):# A[0] ~ A[K-1]
  t *= A[i]
  
for i in range(K, N):
  temp = t // A[i-K] * A[i]
  if t < temp:
    print('Yes')
  else:
    print('No')
  t = temp

Submission status: Time Limit Exceeded

Solution code:
def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    div_i = 0
    tmp_multi = 1
    prev_tmp_multi = 1
    for i in range(N):
        if i <= K - 1:
            tmp_multi *= A[i]
            prev_tmp_multi *= A[i]
        else:
            tmp_multi *= A[i]
            tmp_multi /= A[div_i]
            if tmp_multi > prev_tmp_multi:
                print("Yes")
            else:
                print("No")
            prev_tmp_multi = tmp_multi
            div_i += 1


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
from functools import reduce
from fractions import gcd
import math
import bisect
import itertools
import sys
input = sys.stdin.readline
INF = float("inf")


# 処理内容
def main():
    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, N):
        nscore = score * A[i] // A[i-K]
        if nscore > score:
            print("Yes")
        else:
            print("No")
        score = nscore


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

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]"):
    p = 1
    for i in range(K):
        p*=A[i]
    
    for i in range(K, N):
        pre = p
        p = p // A[i-K] * A[i]
        if p > pre: print(YES)
        else: print(NO)
        pre = p

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

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

Submission status: Time Limit Exceeded

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

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

for i in range(k, n):
    tmp2 = tmp * a[i] // a[i - k]
    if tmp2 > tmp:
        print("Yes")
    else:
        print("No")
    tmp = tmp2

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]

hyo = [0]*N
hyo[K-1] = x

for i in range(K, N):
    hyo[i] = hyo[i-1]*A[i]//A[i-K]
    if hyo[i] > hyo[i-1]:
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

Solution code:
#m-solutions2020 c
import sys,math,collections,itertools
input = sys.stdin.readline

N,K = list(map(int,input().split()))
A = list(map(int,input().split()))
ans = 1
for i in range(K):
    ans *= A[i]
pre = ans
for i in range(K,N):
    now = pre * A[i]//A[i-K]
    if now > pre:
        print('Yes')
    else:
        print('No')
    pre = now

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):
        B = A[k - K:k]
        ret = 1
        for b in B:
            ret *= b

        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:
n,k = map(int,input().split())
a = list(map(int,input().split()))

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

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n, k = map(int, input().split())
l = list(map(int, input().split()))
ans = []
for i in range(1, n):
    l[i] *= l[i - 1]
for i in range(k - 1, n):
    if i == k - 1: ans.append(l[i])
    else:
        ans.append(l[i] // l[i - k])
for i in range(1, len(ans)):
    if ans[i] > ans[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()))


for gakki in range(k+1,n+1):
    pre = A[gakki-k-1:gakki-1]
    pre_ = 1
    for p in pre:
        pre_ *= p

    
    k_gakki = A[gakki-k:gakki]
    k_gakki_ = 1
    for ga in k_gakki:
        k_gakki_ *= ga
    
    if pre_ < k_gakki_:
        print('Yes')
    else:
        print('No')

Submission status: Time Limit Exceeded

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

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

for i in range(k, n):
    nxta = prod // a[i - k] * a[i]
    if nxta > prod:
        print("Yes")
    else:
        print("No")
    prod = nxta

Submission status: Time Limit Exceeded

Solution code:
n, k = map(int, input().split())
aa = tuple(map(int, input().split()))

s = 1
ps = 1
for i in range(n):
    s *= aa[i]
    if i >= k:
        s //= aa[i - k]
        if ps < s:
            print('Yes')
        else:
            print('No')
    ps = s

Submission status: Time Limit Exceeded

Solution code:
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(K, N):
    newans = (ans * A[i]) // A[i-K]
    print('Yes' if ans < newans else 'No')

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
# import sys
import math #sqrt,gcd,pi
# import decimal
# import queue # queue
# import bisect
# import heapq # priolity-queue
# import time
# from itertools import product,permutations,\
    # combinations,combinations_with_replacement
# 重複あり順列、順列、組み合わせ、重複あり組み合わせ
# import collections # deque
# from operator import itemgetter,mul
# from fractions import Fraction
# from functools import reduce

mod = int(1e9+7)
# mod = 998244353
INF = 1<<50

def readInt():
    return list(map(int,input().split()))

def main():
    n,k = readInt()
    a = readInt()
    val = []
    res = 1
    for i in range(n):
        if i<k-1:
            res *= a[i]
        elif i==k-1:
            res *= a[i]
            val.append(res)
        else:
            res //= a[i-k]
            res *= a[i]
            val.append(res)
    for i in range(1,len(val)):
        if val[i-1]<val[i]:
            print("Yes")
        else:
            print("No")
    return

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
for j in range(K-1):
  s *= A[j]
for i in range(K, N):
  if A[i] > A[i-K]:
    print("Yes")
  else:
    print("No")
  s *= A[i]
  s //= A[i-K]

Submission status: Time Limit Exceeded

Solution code:
n,k = map(int,input().split())
a = list(map(int,input().split()))
ans = 0
st = 0
go = k
cnt = sum(a[:go])
for i in range(n-k):
    st += 1
    go += 1
    if cnt < sum(a[st:go]):
        print("Yes")
    else:
        print("No")
    cnt = sum(a[st:go])

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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


resolve()

Submission status: Time Limit Exceeded

Solution code:
def solve(ns, k):
    n = len(ns)
    tot = 1
    for i in xrange(k):
        tot *= ns[i]
    res = []
    pre = tot
    for i in xrange(k, n):
        tot /= ns[i - k]
        tot *= ns[i]
        if tot > pre:
            res.append(True)
        else:
            res.append(False)
        pre = tot
    return res

assert solve([96, 98, 95, 100, 20], 3) == [True, False]
assert solve([1001, 869120, 1001], 2) == [False]
assert solve([3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 8, 9, 7, 9], 7) == [True, True, False, True, True, False, True, True]


n, k = map(int, raw_input().split())
ns = map(int, raw_input().split())

res = solve(ns, k)
for item in res:
    print 'Yes' if item else 'No'

Submission status: Time Limit Exceeded

Solution code:
from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))

n,k=nii()
a=lnii()

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

for i in range(k,n):
  old_p=p
  p//=a[i-k]
  p*=a[i]
  if old_p<p:
    print('Yes')
  else:
    print('No')

Submission status: Time Limit Exceeded

Solution code:
#!usr/bin/env python3
from collections import defaultdict, deque, Counter, OrderedDict
from bisect import bisect_left, bisect_right
from functools import reduce, lru_cache
from heapq import heappush, heappop, heapify

import itertools, bisect
import math, fractions
import sys, copy

def L(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline().rstrip())
def S(): return list(sys.stdin.readline().rstrip())
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI1(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return [list(x) for x in sys.stdin.readline().split()]
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def LIR1(n): return [LI1() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
def LR(n): return [L() for _ in range(n)]

alphabets = "abcdefghijklmnopqrstuvwxyz"

sys.setrecursionlimit(1000000)
dire = [[1, 0], [0, 1], [-1, 0], [0, -1]]
dire8 = [[1, 0], [1, 1], [0, 1], [-1, 1], [-1, 0], [-1, -1], [0, -1], [1, -1]]
MOD = 1000000007

def main():
    N, K = LI()
    A = LI()
    cum = [1] * (N + 1)
    val = []

    for i in range(N):
        cum[i+1] = cum[i] * A[i]

    for i in range(K, N+1):
        val.append(cum[i] // cum[i - K])

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


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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


ans = [b]

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

# print(ans)

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

before = sm
for i in range(K, N):
    sm /= A[i-K]
    sm *= A[i]
    if sm > before:
        print('Yes')
    else:
        print('No')
    before = sm

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(n):
    if i<k:
        x *= a[i]
    else:
        c = x//a[i-k]*a[i]
        print('Yes' if c>x else 'No')
        x = c

Submission status: Time Limit Exceeded

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

t = 1
for i in range(K):# A[0] ~ A[K-1]
  t *= A[i]
  
L = [ 0 for i in range(N)]

L[K-1] = t

for i in range(K, N):
  t = t // A[i-K] * A[i]
  L[i] = t
  
for i in range(K, N):
  if L[i-1] < L[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()))
befscore = 1
score = 1
f = True
for i in range(n):
    score = score * a[i]

    if i >= k:
        score = int(score / a[i - k])
        if befscore >= score:
            print("No")
        else:
            print("Yes")

    befscore = score

Submission status: Time Limit Exceeded

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

temp = 1
for i in range(K):
    temp *= A[i]
flag = 1
for i in range(K, N):
    temp2 = temp
    temp *= A[i]
    temp //= A[i-K]
    if temp2 >= temp:
        print("No")
    else:
        print("Yes")

Submission status: Time Limit Exceeded

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

prod = 1
for i in range(k):
    prod *= As[i]
prods = [prod]

for i in range(k, n):
    prod //= As[i-k]
    prod *= As[i]
    prods.append(prod)
# print(*prods)
prev = prods[0]
for i in range(1,len(prods)):
    if prev < prods[i]:
        print("Yes")
    else:
        print("No")
    prev = prods[i]

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

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

ans = []
for i in range(k, n):
    mul *= a[i]
    mul //= a[i-k]
    if pre < mul:
        ans.append("Yes")
    else:
        ans.append("No")
    pre = mul
print("\n".join(ans))

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8


def main():
    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(N-K):
        pre = score
        score = score // A[i] * A[K+i]
        if score > pre:
            print("Yes")
        else:
            print("No")


main()

Submission status: Time Limit Exceeded

Solution code:
from functools import reduce  # @lru_cache(None)
from operator import mul

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

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

Submission status: Time Limit Exceeded

Solution code:
N, K = map(int, input().split())
A = list(map(int, input().split()))
tmp = 1
ans = []
for i in range(N):
    if i+1 < K:
        tmp *= A[i]
        continue
    tmp *= A[i]
    ans.append(tmp)
    tmp //= A[i-K+1]

for i in range(1,len(ans)):
    if ans[i-1] < ans[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()))

f=1
for i in a[:k]:
  f*=i
bef=f
for (i,j)in zip(a[k:],a[:-k]):
  f*=i
  f//=j

  if bef<f:
    print("Yes")
  else:
    print("No")
  bef=f

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n, k = list(map(int, input().split()))
al = list(map(int, input().split()))
t = 1
for i in range(n):
    tt = t
    t *= al[i]

    if i < k:
        continue
    else:
        t //= al[i-k]
        if tt < t:
            print('Yes')
        else:
            print('No')