Problem:


Score : 500 points

Problem Statement

Takahashi has decided to work on K days of his choice from the N days starting with tomorrow.

You are given an integer C and a string S. Takahashi will choose his workdays as follows:

After working for a day, he will refrain from working on the subsequent C days.

If the i-th character of S is x, he will not work on Day i, where Day 1 is tomorrow, Day 2 is the day after tomorrow, and so on.

Find all days on which Takahashi is bound to work.

Constraints

1 \leq N \leq 2 \times 10^5

1 \leq K \leq N

0 \leq C \leq N

The length of S is N.

Each character of S is o or x.

Takahashi can choose his workdays so that the conditions in Problem Statement are satisfied.

Input

Input is given from Standard Input in the following format:

N K C
S

Output

Print all days on which Takahashi is bound to work in ascending order, one per line.

Sample Input 1

11 3 2
ooxxxoxxxoo

Sample Output 1

6

Takahashi is going to work on 3 days out of the 11 days. After working for a day, he will refrain from working on the subsequent 2 days.

There are four possible choices for his workdays: Day 1,6,10, Day 1,6,11, Day 2,6,10, and Day 2,6,11.

Thus, he is bound to work on Day 6.

Sample Input 2

5 2 3
ooxoo

Sample Output 2

1
5

There is only one possible choice for his workdays: Day 1,5.

Sample Input 3

5 1 0
ooooo

Sample Output 3

There may be no days on which he is bound to work.

Sample Input 4

16 4 3
ooxxoxoxxxoxoxxo

Sample Output 4

11
16



Sample input:
11 3 2
ooxxxoxxxoo


Sample output:
6

Submission status: Wrong Answer

Solution code:
#
# Written by NoKnowledgeGG @YlePhan
# ('ω')
#
#import math
#mod = 10**9+7
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""

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

def main():
  """
  例えば
  00###0###00と並んでて、
  
  00#######00と0を置き換えた時に、k=3日働けるかを確認する
  働けなければ、置き換えた部分は絶対必要なのである。
  
  000...00#00...000で#を介して左部分、右部分で湧けて考える
  出来るだけ左部分は左づめで、右部分は右詰めで頑張る
  k = 9で左4個、右5個となって、9じゃん！！ってなった場合、
  
  【注意することは】
  0#0の時に、C = 3とかだと、 1#1とかになったら駄目ってことが分かる
  (C=3だから、3日#じゃないと駄目）
  
  
  次に、
  000...000#0...000と右に1個変えた場合を考えてみる
  大体似たようなデータになる
  
  
  左から求めた時の0の位置を出来るだけ求めておいて、
  ある場所を介して左部分には何個あるか、っていう
  
  逆に、右から求めた時の0の位置を出来るだけ求めておいて、
  ある場所を介して右部分には何個あるかっていう
  
  この2個を求めた時に、
  #が無理なときに個数がどうなるかなという
  
  この時に注意点が、
  
  左からの時の、分けた時の一番右部分にあるやつ、
  右からの時の、分けた時の1番左部分にあるやつ
  
  まぁどっちかを諦めればよい
  
  【別解？】
  ○を置くんじゃなくて、数付きのボールを置く感じで
  1,2,3,4....
  右からは
       ... 4,5,6
  みたいに
  
  同じ数を置かれる場所を見つける方法のほうがやりやすい？
  
  """
  
  n,k,c = readInts()
  s = input()
  
  i = 0
  l = []
  while i < n and len(l) < k:
    if s[i] == 'o':
      l.append(i)
      i += c+1
    else:
      i += 1
  
  s = s[::-1]
  i = 0
  r = []
  while i < n and len(r) < k:
    if s[i] == 'o':
      r.append(i)
      i += c+1
    else:
      i += 1
  for i in range(k):
    r[i] = n - 1 - r[i]
  
  s = s[::-1]
  
  """for i in range(n):
    if s[i] == 'x':
      continue
    cnt = """#なにこれ
  
  lastL = [-1] * (n+1)
  for i in range(k):
    lastL[l[i]+1] = i
  for i in range(n):
    if lastL[i+1] == -1:
      lastL[i+1] = lastL[i]
      
      
  lastR = [-1] * (n+1)
  for i in range(k):
    lastR[r[i]] = i
  for i in range(n-1,-1,-1):
    if lastR[i] == -1:
      lastR[i] = lastR[i+1]
  
  for i in range(n):
    if s[i] == 'x':
      continue
    li = lastL[i]
    ri = lastR[i+1]
    cnt = 0
    if li != -1:
      cnt += li+1
    if ri != -1:
      cnt += ri+1
    if li!=-1 and ri!= -1 and (r[ri]-l[ri] <= c):
      cnt -=1
    if cnt >= k:
      continue
    print(i+1)
  
if __name__ == '__main__':
  main()

Submission status: Wrong Answer

Solution code:
#!python3

iim = lambda: map(int, input().rstrip().split())
from collections import defaultdict

def resolve():
    N, K, C = iim()
    S = input()

    ax = []
    i = N-1
    c1 = C
    while i >= 0:
        if S[i] != "o":
            i -= 1
        else:
            ax.append(i)
            i -= C + 1
            if len(ax) == K:
                break

    ans, ri, cnt, i  = [], len(ax)-1, 0, 0
    while i < N:
        if S[i] != "o":
            i += 1
        else:
            for ri in range(ri, -1, -1):
                diff = i - ax[ri]
                if diff == 0:
                    ans.append(i+1)
                    ri -= 1
                    break
                elif diff < 0:
                    break
            else:
                break
            i += C + 1
            cnt += 1
            if cnt  == K:
                break
    print(*ans, sep="\n")

if __name__ == "__main__":
    resolve()

Submission status: Wrong Answer

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

L = []
R = []
holiday = 0

for i in range(N):
  if holiday:
    holiday -= 1
  elif S[i] == 'o':
    L.append(i)
    holiday = C
holiday = 0
for i in range(N-1, -1, -1):
  if holiday:
    holiday -= 1
  elif S[i] == 'o':
    R.append(i)
    holiday = C
out = set(L) and set(R)
if len(L) == K and len(R) == K:
  for n in out:
    print(n+1)

Submission status: Wrong Answer

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

L = []
R = []
holiday = 0

for i in range(N):
  if holiday:
    holiday -= 1
  elif S[i] == 'o':
    L.append(i)
    holiday = C
holiday = 0
for i in range(N-1, -1, -1):
  if holiday:
    holiday -= 1
  elif S[i] == 'o':
    R.append(i)
    holiday = C
out = set(L) and set(R)
if len(L) >= K and len(R) >= K:
  for n in out:
    print(n+1)

Submission status: Wrong Answer

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


def solve(N: int, K: int, C: int, S: str):
    left_greedy = []
    right_greedy = []

    # left_greedyのリストの作成
    sabori_count = 0
    hataraki_count = 0
    for idx, s in enumerate(S):
        if hataraki_count == K:
            break
        sabori_count += 1
        if sabori_count > 0 and s == 'o':
            left_greedy.append(idx)
            sabori_count = -1 * C
            hataraki_count += 1

    # right_greedyのリストの作成
    sabori_count = 0
    hataraki_count = 0
    for idx, s in enumerate(S[::-1]):
        if hataraki_count == K:
            break
        sabori_count += 1
        if sabori_count > 0 and s == 'o':
            right_greedy.append(N-1-idx)
            sabori_count = -1 * C
            hataraki_count += 1

    left_greedy = set(left_greedy)
    right_greedy = set(right_greedy)
    intersection = left_greedy & right_greedy
    intersection = list(intersection)
    intersection = sorted(intersection)
    for i in intersection:
        print(i + 1)

    return


# Generated by 1.1.6 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
    C = int(next(tokens))  # type: int
    S = next(tokens)  # type: str
    solve(N, K, C, S)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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


def solve(N: int, K: int, C: int, S: str):
    left_greedy = []
    right_greedy = []

    # left_greedyのリストの作成
    sabori_count = 0
    hataraki_count = 0
    for idx, s in enumerate(S):
        if hataraki_count == K:
            break
        sabori_count += 1
        if sabori_count > 0 and s == 'o':
            left_greedy.append(idx)
            sabori_count = -1 * C
            hataraki_count += 1

    # right_greedyのリストの作成
    sabori_count = 0
    hataraki_count = 0
    for idx, s in enumerate(S[::-1]):
        if hataraki_count == K:
            break
        sabori_count += 1
        if sabori_count > 0 and s == 'o':
            right_greedy.append(N-1-idx)
            sabori_count = -1 * C
            hataraki_count += 1

    left_greedy = set(left_greedy)
    right_greedy = set(right_greedy)
    intersection = left_greedy & right_greedy
    for i in intersection:
        print(i + 1)
    return


# Generated by 1.1.6 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
    C = int(next(tokens))  # type: int
    S = next(tokens)  # type: str
    solve(N, K, C, S)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N, K, C = map(int, input().split())
S = input()
start = S.find('o')
stop = S.rfind('o')

left = [start]
for i in range(1, K):
    nd = left[-1] + C + 1
    while S[nd] == 'x':
        nd += 1
    left.append(nd)

right = [stop]
for i in range(1, K):
    nd = right[0] - C - 1
    while S[nd] == 'x':
        nd -= 1
    right.insert(0, nd)
for d in set(left) & set(right):
    print(d + 1)

Submission status: Wrong Answer

Solution code:
N, K, C = map(int, input().split())
S = input()
start = S.find('o')
stop = S.rfind('o')

left = [start]
for i in range(1, K):
    nd = left[-1] + C + 1
    while S[nd] == 'x':
        nd += 1
    left.append(nd)

right = [stop]
for i in range(1, K):
    nd = right[-1] - C - 1
    while S[nd] == 'x':
        nd -= 1
    right.append(nd)

for d in set(left) & set(right):
    print(d + 1)

Submission status: Wrong Answer

Solution code:
n,k,c=map(int,input().split())
s=input()
l=set()
cnt=0
next=-1
for i in range(n):
    if s[i]=='o' and i>next:
        l.add(i)
        cnt+=1
        next=i+c
    if cnt>=k:
        break
r=set()
cnt=0
next=n
for i in range(n-1,-1,-1):
    if s[i]=='o' and i<next:
        r.add(i)
        cnt+=1
        next=i-c
    if cnt>=k:
        break
ans=l&r
for i in ans:
    print(i+1)

Submission status: Wrong Answer

Solution code:
N,K,C = map(int,input().split())
S = str(input())
works1 = 0
works2 = 0
l1 = []
l2 = []
for i in range(N):
  if S[i] == 'o':
    works1 += 1
    l1.append(i+1)
    i += C-1
  if works1 == K:
    break

for i in range(N):
  if S[-i-1] == 'o':
    works2 += 1
    l2.append(N-i)
    i += C-1
  if works2 == K:
    break

l1.extend(l2)
l = [x for x in set(l1) if l1.count(x) > 1]
for i in range(len(l)):
  print(l)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sun Apr  5 22:11:18 2020

@author: Kanaru Sato
"""

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

early = []
late = []

i = 0
count = 0
while i < n and count < k:
    if s[i] == "o":
        early.append(i)
        i = i+c+1
        count = count+1
    else:
        i = i+1

print(early)

i = n-1
count = 0
while i > -1 and count < k:
    if s[i] == "o":
        late.append(i)
        i = i-c-1
        count = count+1
    else:
        i = i-1

for i in range(len(early)):
    if early[i] == late[k-i-1]:
        print(early[i]+1)

Submission status: Wrong Answer

Solution code:
L=[]
R=[]
N,K,C=map(int,input().split())
S=list(input())
s=S[::-1]
i=0
while len(L)<K:
    if S[i]=='o':
        L.append(i+1)
        if i+C<N:
            for j in range(1,C+1):
                S[i+j]='x'
    i+=1
print(L)
k=0
while len(R)<K:
    if s[k]=='o':
        R.append(N-k)
        if k+C<N:
            for l in range(1,C+1):
                s[k+l]='x'
    k+=1
R=R[::-1]
ans=[]
for i in range(K):
    if L[i]==R[i]:
        ans.append(L[i])
print(*ans)

Submission status: Wrong Answer

Solution code:
n,k,c=map(int,input().split())
s=list(input())
for i in range(len(s)):
	if s[i]=="o":
		s[i]=True
	else:
		s[i]=False
i=0
work1=[]
while len(work1)<k:
	if s[i]:
		work1.append(i)
		i+=c+1
	else:
		i+=1
i=n-1
work2=[]
while len(work2)<k:
	if s[i]:
		work2.append(i)
		i-=c+1
	else:
		i-=1
for i in range(k):
	if work1[i]==work2[i]:
		print(work1[i]+1)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sun Apr  5 22:11:18 2020

@author: Kanaru Sato
"""

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

early = []
late = []

i = 0
count = 0
while i < n and count < k:
    if s[i] == "o":
        early.append(i)
        i = i+c+1
        count = count+1
    else:
        i = i+1

i = n-1
count = 0
while i > -1 and count < k:
    if s[i] == "o":
        late.append(i)
        i = i-c-1
        count = count+1
    else:
        i = i-1

late = set(late)

for index in early:
    if index in late:
        print(index+1)

Submission status: Wrong Answer

Solution code:
N, K, C = map(int, input().split())
S = input()
work_day_front = [-1 for _ in range(N)]
work_day_back = [-1 for _ in range(N)]
now = 0
rest = 0
for i, c in enumerate(S):
    if rest > 0:
        rest -= 1
        work_day_front[i] = now
        continue

    if c == 'o':
        now += 1
        rest = C
    work_day_front[i] = now

now = 0
rest = 0
for i, c in enumerate(S[::-1]):
    if rest > 0:
        rest -= 1
        work_day_back[i] = now
        continue

    if c == 'o':
        now += 1
        rest = C
    work_day_back[i] = now

work_day_back = work_day_back[::-1]

if work_day_front[-1] > K:
    print()
    exit()
ans = []
for i in range(N-1):
    if work_day_back[i] > work_day_back[i+1]:
        if i == 0:
            ans.append(str(i+1))
        elif work_day_front[i-1] < work_day_front[i]:
            ans.append(str(i+1))
if work_day_front[N-1] > work_day_front[N-2]:
    ans.append(str(N))
#print(work_day_back)
#print(work_day_front)
print("\n".join(ans))

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sun Apr  5 22:11:18 2020

@author: Kanaru Sato
"""

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

early = []
late = []

i = 0
count = 0
while i < n and count < k:
    if s[i] == "o":
        early.append(i)
        i = i+c+1
        count = count+1
    else:
        i = i+1

i = n-1
count = 0
while i > -1 and count < k:
    if s[i] == "o":
        late.append(i)
        i = i-c-1
        count = count+1
    else:
        i = i-1

early = set(early)
late = set(late)

for index in early:
    if index in late:
        print(index+1)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sun Apr  5 22:11:18 2020

@author: Kanaru Sato
"""

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

early = []
late = []

i = 0
count = 0
while i <= n-1 and count < k:
    if s[i] == "o":
        early.append(i)
        i = i+c+1
        count = count+1
    else:
        i = i+1

i = n-1
count = 0
while i >= 0 and count < k:
    if s[i] == "o":
        late.append(i)
        i = i-c-1
        count = count+1
    else:
        i = i-1

early = set(early)
late = set(late)

for index in early:
    if index in late:
        print(index+1)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sun Apr  5 22:11:18 2020

@author: Kanaru Sato
"""

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

early = []
late = []

i = 0
while i <= n-1:
    if s[i] == "o":
        early.append(i)
        i = i+c+1
    else:
        i = i+1

i = n-1
while i >= 0:
    if s[i] == "o":
        late.append(i)
        i = i-c-1
    else:
        i = i-1

early = set(early)
late = set(late)

for index in early:
    if index in late:
        print(index+1)

Submission status: Wrong Answer

Solution code:
n,k,c=map(int, input().split())
s=input()
L=[0]*k
R=[0]*k
m=0
l=0
for i in range(k):
    while s[m]=="x":
        m+=1
    L[i]=m
    m+=c+1
    while s[n-l-1]=="x":
        l+=1
    R[i]=n-l-1
    l+=c+1
for i in range(k):
    if sorted(R)[i]==L[i]:
        print(R[i]+1)

Submission status: Wrong Answer

Solution code:
n,k,c=map(int, input().split())
s=input()
L=[0]*k
R=[0]*k
m=0
for i in range(k):
    while s[m]=="x":
        m+=1
    L[i]=m
    m+=c+1
m=0
for i in range(k):
    while s[n-m-1]=="x":
        m+=1
    R[i]=n-m-1
    m+=c+1
for i in range(k):
    if sorted(R)[i]==L[i]:
        print(R[i]+1)

Submission status: Wrong Answer

Solution code:
n,k,c=map(int, input().split())
s=input()
L=[0]*k
R=[0]*k
m=0
for i in range(k):
    while s[m]=="x":
        m+=1
    L[i]=m
    m+=c+1
m=0
for i in range(k):
    while s[m]=="x":
        m+=1
    R[i]=n-m-1
    m+=c+1
for i in range(k):
    if sorted(R)[i]==L[i]:
        print(R[i]+1)

Submission status: Wrong Answer

Solution code:
N,K,C = map(int,input().split())
S = input()
L = []
R = []
i = 0
while i < N:
    if S[i] == "o":
        L.append(i)
        if len(L) == K:
            break
        i += C
    else:
        i += 1
i = N-1
while i >= 0:
    if S[i] == "o":
        R.append(i)
        if len(R) == K:
            break
        i -= C
    else:
        i -= 1
R.reverse()
for i in range(K):
    if L[i] == R[i]:
        print(L[i]+1)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sun Apr  5 19:21:44 2020

@author: Kanaru Sato
"""

def first(s:str):
        i = 0
        while s[i] != "o" or i == len(s):
            i += 1
        if i == len(s):
            return -1
        else:
            return i


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

ear = []
start = 0
while True:
    day = first(s)
    if day == -1:
        break
    else:
        ear.append(day+start)
        start = day+start+c+1
        if day+c+1 >= len(s):
            break
        else:
            s = s[day+c+1:len(s)]

s = []
for i in range(n):
    s.append(ns[n-i-1])

lat = []
start = 0
while True:
    day = first(s)
    if day == -1:
        break
    else:
        lat.append(day+start)
        start = day+start+c+1
        if day+c+1 >= len(s):
            break
        else:
            s = s[day+c+1:len(s)]

for i in range(len(lat)):
    lat[i] = n-lat[i]-1

ear = set(ear)
lat = set(lat)

for i in range(n):
    if i in ear and i in lat:
        print(i+1)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sun Apr  5 19:21:44 2020

@author: Kanaru Sato
"""

def first(s:str, reverse:int):
    if reverse == 0:
        i = 0
        while s[i] != "o" or i == len(s):
            i += 1
        if i == len(s):
            return -1
        else:
            return i
    if reverse == 1:
        for i in range(len(s)//2):
            tmp = s[i]
            s[i] = s[len(s)-i-1]
            s[len(s)-i-1] = tmp
        return len(s)-first(s,0)-1


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

ear = []
lat = []
start = 0

while True:
    day = first(s,0)
    if day == -1:
        break
    else:
        ear.append(day+start)
        start = day+start+c+1
        if day+c+1 >= len(s):
            break
        else:
            s = s[day+c+1:len(s)]
s = ns

while True:
    day = first(s,1)
    if day == -1:
        break
    else:
        lat.append(day)
        start = day-c-1
        if start <= -1:
            break
        else:
            s = s[0:start+1]

ear = set(ear)
lat = set(lat)

for i in range(n):
    if i in ear and i in lat:
        print(i+1)

Submission status: Wrong Answer

Solution code:
N, K, C = map(int, input().split())
S = str(input())

#前から貪欲に
x = 0
L = []
while x < N:
  if S[x] == "o":
    L.append(x)
    x += C + 1
  else:
    x += 1

#後ろから貪欲に    
y = N - 1
R = []
while y > -1:
  if S[y] == "o":
    R.append(y)
    y -= C + 1
  else:
    y -= 1
    
#LとRの被っている数に1足したものを出力
for i in range(len(L)):
  if L[i] in R:
    print(L[i] + 1)

Submission status: Wrong Answer

Solution code:
ss = input().split()
n,k,c = map(int, ss)
s = input()

f = [False] * n
b = [False] * n

# forward
i = 0
fk = 0
while i < n and fk < k:
  if s[i] == 'x':
    i += 1
  else:
    f[i] = True
    i += (c + 1)
    fk += 1
    

# backward
n -= 1
bk = 0
while 0 <= n and bk < k:
  if s[n] == 'x':
    n -= 1
  else:
    b[n] = True
    n -= (c + 1)
    bk += 1

for i,(x,y) in enumerate(zip(f, b)):
  if x and y:
    print(i+1)

Submission status: Wrong Answer

Solution code:
import sys

N, K, C = map(int, sys.stdin.readline().rstrip().split())
S = sys.stdin.readline().rstrip()

L = [0] * K
R = [0] * K
candidates = [i + 1 for i in range(N) if S[i] == 'o']

L[0] = candidates[0]
R[0] = candidates[-1]
cL = L[0]
cR = R[0]
kL = 1
kR = 1
for li in range(len(candidates)):
    ri = -(li + 1)
    if candidates[li] - cL > C and kL < K:
        L[kL] = cL = candidates[li]
        kL += 1
    if cR - candidates[ri] > C and kR < K:
        R[kR] = cR = candidates[ri]
        kR += 1
    if kL == kR == 0:
        break

if kL < K or kR < K:
    sys.exit()

ans = [False] * N
for l in L:
    ans[l - 1] = True

for r in R:
    if ans[r - 1]:
        print(r)

Submission status: Wrong Answer

Solution code:
ss = input().split()
n,k,c = map(int, ss)
s = input()

f = [False] * n
b = [False] * n

# forward
i = 0
while i < n:
  if s[i] == 'x':
    i += 1
  else:
    f[i] = True
    i += (c + 1)
    

# backward
n -= 1
while 0 <= n:
  if s[n] == 'x':
    n -= 1
  else:
    b[n] = True
    n -= (c + 1)

for i,(x,y) in enumerate(zip(f, b)):
  if x and y:
    print(i+1)

Submission status: Wrong Answer

Solution code:
n,k,c = map(int,input().split())
S = input()

left = [ -1 for i in range(k)]
right = [ -1 for i in range(k)]

pointer = 0
for l in range(k):

  for s in range(pointer,n):
    if S[s] == 'o':
      left[l] = s
      pointer = s+c
      break

pointer = n-1
for r in range(k):

  for s in range(pointer,0,-1):
    if S[s] == 'o':
      right[r] = s
      pointer = s-c
      break

for l,r in zip(left, right[::-1]):
  if l==r:
    print(l+1)

Submission status: Wrong Answer

Solution code:
import sys
from collections import Counter

N, K, C = map(int, sys.stdin.readline().rstrip().split())
S = sys.stdin.readline().rstrip()

candidates = [i + 1 for i in range(N) if S[i] == 'o']

cL = candidates[0]
cR = candidates[-1]
counter = Counter([cL, cR])
kL = 1
kR = 1
for li in range(len(candidates)):
    ri = -(li + 1)
    if candidates[li] - cL > C and kL < K:
        cL = candidates[li]
        counter[cL] += 1
        kL += 1
    if cR - candidates[ri] > C and kR < K:
        cR = candidates[ri]
        counter[cR] += 1
        kR += 1
    if kL == kR == 0:
        break

if kL < K or kR < K or len(counter) == 2 * K:
    sys.exit()

for k, v in counter.items():
    if v > 1:
        print(k)

Submission status: Wrong Answer

Solution code:
N, K, C = map(int, input().split())
S = input()
p = -float('inf')
a = [0] * N
for i, v in enumerate(S):
    if v == 'o' and i - p >= C+1:
        p = i
        a[i] += 1

p = float('inf')
for i in range(N-1, -1, -1):
    if S[i] == 'o' and p - i >= C+1:
        p = i
        a[i] += 1

ans = []
for i, v in enumerate(a):
    if v >= 2:
        ans.append(i+1)

if len(ans) < K:
    for i in ans:
        print(i)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
n,k,c=map(int,input().split())
s=input()
#働く日のうちi日目についてそれ以後でないと働けない日をL[i]とする配列を考える
#働く日のうちi日目についてそれ以前でないと働けない日をR[i]とする配列も考える
#その二つが同じとき、必ず働かなければいけない日になる
#L[i]があった時、L[i]+c+1以降からしか働けないことに注意(vice versa)

#バグ？なんで？
l=[-1]*k
r=[-1]*k
nowl=0
indl=0
while nowl<n and indl<k:
    for i in range(nowl,n):
        if s[i]=="o":
            l[indl]=i
            nowl=i+c+1
            indl+=1
            break
nowr=n-1
indr=k-1
while nowr>=0 and indr>=0:
    for i in range(nowr,-1,-1):
        if s[i]=="o":
            r[indr]=i
            nowr=i-c-1
            indr-=1
            break
for i in sorted(list(set(l)&set(r))):
    print(i+1)

Submission status: Wrong Answer

Solution code:
import sys
from collections import Counter

N, K, C = map(int, sys.stdin.readline().rstrip().split())
S = sys.stdin.readline().rstrip()

L = [0] * K
R = [0] * K
candidates = [i + 1 for i in range(N) if S[i] == 'o']

L[0] = candidates[0]
R[-1] = candidates[-1]
cL = L[0]
cR = R[-1]
kL = 1
kR = 1
for li in range(len(candidates)):
    ri = -(li + 1)
    if candidates[li] - cL > C and kL < K:
        L[kL] = cL = candidates[li]
        kL += 1
    if cR - candidates[ri] > C and kR < K:
        R[-(kR + 1)] = cR = candidates[ri]
        kR += 1
    if kL == kR == 0:
        break

if kL < K or kR < K:
    sys.exit()

c = Counter(L + R)
if len(c) == len(L + R):
    sys.exit()

for k, v in c.items():
    if v > 1:
        print(k)

Submission status: Wrong Answer

Solution code:
N,K,C=map(int,input().split())
S=input()
L=[]
R=[]
n=0
rc=0
lc=0
while True:
  if lc==K:
    break
  if S[n]=="o":
    L+=[n+1]
    n+=C
    lc+=1
  else:
    n+=1
n=N-1
while True:
  if rc==K:
    break
  if S[n]=="o":
    R+=[n+1]
    n-=C
    rc+=1
  else:
    n-=1
for i in L:
  if i in R:
    print(i)

Submission status: Wrong Answer

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

Sr = "".join(list(reversed(S)))

wd = []
wdl = []

pw = 0
pwl = 0

for d in range(K):

    # 先詰めを探す
    while True:
        if S[pw] == ('o'):
            wd.append(pw)
            break
        pw += 1
    pw += C + 1
    
    # 後詰めを探す
    while True:
        if Sr[pwl] == ('o'):
            wdl.append(pwl)
            break
        pwl += 1
    pwl += C + 1

wdl.sort()
    
for i in range(K):
    if wd[i] == wdl[i]:
        print(wd[i] + 1)

Submission status: Wrong Answer

Solution code:
n,k,c=map(int,input().split())
s=input()
#働く日のうちi日目についてそれ以後でないと働けない日をL[i]とする配列を考える
#働く日のうちi日目についてそれ以前でないと働けない日をR[i]とする配列も考える
#その二つが同じとき、必ず働かなければいけない日になる
#L[i]があった時、L[i]+c+1以降からしか働けないことに注意(vice versa)

l=[-1]*k
r=[-1]*k
nowl=0
indl=0
while nowl<n and indl<k:
    for i in range(nowl,n):
        if s[i]=="o":
            l[indl]=i
            nowl=i+c+1
            indl+=1
            break
nowr=n-1
indr=k-1
while nowr>=0 and indr>=0:
    for i in range(nowr,-1,-1):
        if s[i]=="o":
            r[indr]=i
            nowr=i-c-1
            indr-=1
            break
for i in sorted(list(set(l)&set(r))):
    if i!=-1:
        print(i+1)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
from bisect import bisect_left, bisect_right
N,K,C=map(int, sys.stdin.readline().split())
S=sys.stdin.readline().strip()

if C==0: quit()

#左から
L=[]
over=-1
L_cnt=0
for i,x in enumerate(S):
    if x=="o" and over<i:
        L.append(i)
        L_cnt+=1
        if L_cnt==K: break
        over=i+C

#右から
R=[]
over=-1
R_cnt=0
for i,x in enumerate(S[::-1]):
    if x=="o" and over<i:
        R.append(N-1-i)
        R_cnt+=1
        if R_cnt==K: break
        over=i+C

L=L+R
L.sort()

prev=None
for x in L:
    if x==prev:
        print x+1
    prev=x

Submission status: Wrong Answer

Solution code:
n,k,c=map(int,input().split())
s=input()
#働く日のうちi日目についてそれ以後でないと働けない日をL[i]とする配列を考える
#働く日のうちi日目についてそれ以前でないと働けない日をR[i]とする配列も考える
#その二つが同じとき、必ず働かなければいけない日になる
#L[i]があった時、L[i]+c+1以降からしか働けないことに注意(vice versa)

l=[-1]*k
r=[-1]*k
nowl=0
indl=0
while nowl<n and indl<k:
    for i in range(nowl,n):
        if s[i]=="o":
            l[indl]=i
            nowl=i+c+1
            indl+=1
            break
nowr=n-1
indr=k-1
while nowr>=0 and indr>=0:
    for i in range(nowr,-1,-1):
        if s[i]=="o":
            r[indr]=i
            nowr=i-c-1
            indr-=1
            break
for i in sorted(list(set(l)&set(r))):
    print(i+1)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
from bisect import bisect_left, bisect_right
N,K,C=map(int, sys.stdin.readline().split())
S=sys.stdin.readline().strip()

#左から
L=[]
over=-1
L_cnt=0
for i,x in enumerate(S):
    if x=="o" and over<i:
        L.append(i)
        L_cnt+=1
        if L_cnt==K: break
        over=i+C

#右から
R=[]
over=-1
R_cnt=0
for i,x in enumerate(S[::-1]):
    if x=="o" and over<i:
        R.append(N-1-i)
        R_cnt+=1
        if R_cnt==K: break
        over=i+C

L=L+R
L.sort()

prev=None
for x in L:
    if x==prev:
        print x+1
    prev=x

Submission status: Wrong Answer

Solution code:
N,K,C = map(int, input().split())
S = list(input())
A=[]
for i in range(len(S)):
    if S[i] == "o":
        A.append(i+1)
B=[]
for i in A:
    for j in A:
        if j - i >= C+1:
            B.append([i,j])
D=[]
for k in range(K-2):
    for i in range(len(B)):
        for j in range(i+1,len(B)):
            if B[i][1:] == B[j][:k+1]:
                E = B[i]
                E.extend([B[j][k+1]])
                D.append(E)
    B = D
    D = []

n = [0]*N
for _ in range(len(B)):
    for i in range(N):
        if B[_].count(i+1) != 0:
            n[i] +=1
for _ in range(N):
    if n[_] == len(B):
        print(_+1)

Submission status: Wrong Answer

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

work_date = []

# 先詰めで出勤する場合
pw = 0

for d in range(K):

    w = S[pw:].index('o') + pw
    work_date.append(w)

    # 次出勤する可能性がある、最初の日を探す
    pw = w + C + 1
    
# 後詰めで出勤する場合
work_date_l = []

Sr = str(list(reversed(S)))
pw = 0

for d in range(K):

    w = Sr[pw:].index('o') + pw
    work_date_l.append((N-1)-w)

    # 次出勤する可能性がある、最初の日を探す
    pw = w + C + 1

work_date_l.sort()
    
count = 0
for i in range(K):
    if work_date[i] == work_date_l[i]:
        count += 1
        
print(count)

Submission status: Wrong Answer

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

work_date = []
count = 0

# 先詰めで出勤する場合
pw = 0

for d in range(K):

    w = S[pw:].index('o') + pw
    work_date.append(w)

    # 次出勤する可能性がある、最初の日を探す
    pw = w + C + 1
    
# 後詰めで出勤する場合
work_date_l = []

Sr = list(reversed(S))
pw = 0

for d in range(K):

    w = Sr[pw:].index('o') + pw
    work_date_l.append((N-1)-w)

    # 次出勤する可能性がある、最初の日を探す
    pw = w + C + 1

work_date_l.sort()
    
count = 0
for i in range(K):
    if work_date[i] == work_date_l[i]:
        count += 1
        
print(count)

Submission status: Wrong Answer

Solution code:
# import time

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

F = []
L = []

# t1 = time.time()
# for i in range(N):
#     if S[i] == 'o':
#         if len(F) == 0:
#             F.append(i)
#         elif F[-1] + C < i:
#             F.append(i)
#     if len(F) >= K:
#         break
# print(F)
# t2 = time.time()
i = 0
while len(F) < K and i < N:
    if S[i] == 'o':
        if len(F) == 0:
            F.append(i)
        elif F[-1] + C < i:
            F.append(i)
    i += 1
# print(F)
# t3 = time.time()

# print(t2 - t1, t3 - t2)

i = N - 1
while len(L) < K and i >= 0:
    if S[i] == 'o':
        if len(L) == 0:
            L.append(i)
        elif L[-1] - C > i:
            L.append(i)
    i -= 1

ans = [i + 1 for i in set(F) & set(L)]
if len(ans) != 0:
    ans.sort()
    [print(i) for i in ans]
else:
    print()

Submission status: Wrong Answer

Solution code:
import itertools
# import time

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

F = []
L = []

# t1 = time.time()
# for i in range(N):
#     if S[i] == 'o':
#         if len(F) == 0:
#             F.append(i)
#         elif F[-1] + C < i:
#             F.append(i)
#     if len(F) >= K:
#         break
# print(F)
# t2 = time.time()
i = 0
while len(F) < K:
    if S[i] == 'o':
        if len(F) == 0:
            F.append(i)
        elif F[-1] + C < i:
            F.append(i)
    i += 1
# print(F)
# t3 = time.time()

# print(t2 - t1, t3 - t2)

i = N - 1
while len(L) < K:
    if S[i] == 'o':
        if len(L) == 0:
            L.append(i)
        elif L[-1] - C > i:
            L.append(i)
    i -= 1

ans = [i + 1 for i in set(F) & set(L)]
if len(ans) != 0:
    ans.sort()
    [print(i) for i in ans]
else:
    print()