結果

問題 No.1313 N言っちゃダメゲーム (4)
ユーザー googol_S0googol_S0
提出日時 2020-12-10 00:12:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 522 ms / 2,000 ms
コード長 1,122 bytes
コンパイル時間 158 ms
コンパイル使用メモリ 81,620 KB
実行使用メモリ 127,060 KB
最終ジャッジ日時 2023-10-19 10:29:16
合計ジャッジ時間 11,305 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 47 ms
55,576 KB
testcase_01 AC 44 ms
55,576 KB
testcase_02 AC 45 ms
55,576 KB
testcase_03 AC 44 ms
53,528 KB
testcase_04 AC 44 ms
53,528 KB
testcase_05 AC 43 ms
53,616 KB
testcase_06 AC 44 ms
53,528 KB
testcase_07 AC 43 ms
55,576 KB
testcase_08 AC 48 ms
55,576 KB
testcase_09 AC 43 ms
55,576 KB
testcase_10 AC 43 ms
55,576 KB
testcase_11 AC 43 ms
55,576 KB
testcase_12 AC 43 ms
55,576 KB
testcase_13 AC 454 ms
127,056 KB
testcase_14 AC 514 ms
127,060 KB
testcase_15 AC 504 ms
127,056 KB
testcase_16 AC 487 ms
127,056 KB
testcase_17 AC 339 ms
100,644 KB
testcase_18 AC 368 ms
100,372 KB
testcase_19 AC 332 ms
100,368 KB
testcase_20 AC 144 ms
80,364 KB
testcase_21 AC 251 ms
86,568 KB
testcase_22 AC 222 ms
86,544 KB
testcase_23 AC 330 ms
100,360 KB
testcase_24 AC 154 ms
80,364 KB
testcase_25 AC 382 ms
100,368 KB
testcase_26 AC 123 ms
77,104 KB
testcase_27 AC 249 ms
86,556 KB
testcase_28 AC 405 ms
100,644 KB
testcase_29 AC 403 ms
100,644 KB
testcase_30 AC 522 ms
127,060 KB
testcase_31 AC 400 ms
100,644 KB
testcase_32 AC 501 ms
127,056 KB
testcase_33 AC 442 ms
100,644 KB
testcase_34 AC 421 ms
100,644 KB
testcase_35 AC 449 ms
127,056 KB
testcase_36 AC 430 ms
100,644 KB
testcase_37 AC 488 ms
127,056 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from copy import *
def init(N,node,A,unit,func):
  n=1
  while n<N:
    n<<=1
  for i in range(n*2-1):
    if len(node)<=i:
      node.append(deepcopy(unit))
    else:
      node[i]=deepcopy(unit)
  for i in range(len(A)):
    node[n-1+i]=deepcopy(A[i])
  for i in range(n-2,-1,-1):
    node[i]=func(node[(i<<1)+1],node[(i<<1)+2])
  node.append(func)
  node.append(unit)
  node.append(n)

def upd(node,x,a):
  y=node[-1]+x
  node[y-1]=a
  while y>1:
    y=y>>1
    node[y-1]=node[-3](node[(y<<1)-1],node[y<<1])

def query(node,l,r):
  x,y=l,r
  z=node[-1]-1
  rr=deepcopy(node[-2])
  rl=deepcopy(node[-2])
  while True:
    if x==y:
      return node[-3](rl,rr)
    if x&1:
      rl=node[-3](rl,node[x+z])
      x+=1
    if y&1:
      rr=node[-3](node[y+z-1],rr)
    if z==0:
      return node[-3](rl,rr)
    x>>=1
    y>>=1
    z>>=1

N,K=map(int,input().split())
S=input()
T=[]
P=[]
init(N+K,T,[],1,lambda x,y:min(x,y))
for i in range(N,N+K):
  upd(T,i,1)
for i in range(N-1,0,-1):
  x=(1-query(T,i+1,i+K+1))|(S[i-1]=='x')
  upd(T,i,x)
  if x==0 and i<=K:
    P.append(i)
if len(P)==0:
  print(0)
else:
  print(*P[::-1])
0