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:
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
from itertools import permutations,combinations,groupby
import sys,bisect,string,math,time,functools,random
def Golf():*a,=map(int,open(0))
def I():return int(input())
def S_():return input()
def IS():return input().split()
def LS():return [i for i in input().split()]
def LI():return [int(i) for i in input().split()]
def LI_():return [int(i)-1 for i in input().split()]
def NI(n):return [int(input()) for i in range(n)]
def NI_(n):return [int(input())-1 for i in range(n)]
def StoLI():return [ord(i)-97 for i in input()]
def ItoS(n):return chr(n+97)
def LtoS(ls):return ''.join([chr(i+97) for i in ls])
def GI(V,E,Directed=False,index=0):
    org_inp=[];g=[[] for i in range(n)]
    for i in range(E):
        inp=LI();org_inp.append(inp)
        if index==0:inp[0]-=1;inp[1]-=1
        if len(inp)==2:
            a,b=inp;g[a].append(b)
            if not Directed:g[b].append(a)
        elif len(inp)==3:
            a,b,c=inp;aa=(inp[0],inp[2]);bb=(inp[1],inp[2]);g[a].append(bb)
            if not Directed:g[b].append(aa)
    return g,org_inp
def GGI(h,w,boundary=1,search=[],replacement_of_found='.',mp_def={'#':1,'.':0}):
#h,w,g,sg=GGI(h,w,boundary=1,search=['S','G'],replacement_of_found='.',mp_def={'#':1,'.':0}) # sample usage
    mp=[boundary]*(w+2);found={}
    for i in range(h):
        s=input()
        for char in search:
            if char in s:
                found[char]=((i+1)*(w+2)+s.index(char)+1)
                mp_def[char]=mp_def[replacement_of_found]
        mp+=[boundary]+[mp_def[j] for j in s]+[boundary]
    mp+=[boundary]*(w+2)
    return h+2,w+2,mp,found
def TI(n):return GI(n,n-1)
def bit_combination(k,n=2):return [[tb//(n**bt)%n for bt in range(k)] for tb in range(n**k)]
def show(*inp,end='\n'):
    if show_flg:print(*inp,end=end)
def show2d(g,h,w):
    for i in range(h):show(g[i*w:i*w+w])

YN=['YES','NO'];Yn=['Yes','No']
mo=10**9+7
inf=float('inf')
l_alp=string.ascii_lowercase
#sys.setrecursionlimit(10**7)
input=lambda: sys.stdin.readline().rstrip()


## return prime factors of N as dictionary {prime p:power of p}
## within 2 sec for N = 2*10**20+7
def primeFactor(N):
    i,n=2,N
    ret={}
    d,sq=2,99
    while i<=sq:
        k=0
        while n%i==0:
            n,k,ret[i]=n//i,k+1,k+1
        if k>0 or i==97:
            sq=int(n**(1/2)+0.5)
        if i<4:
            i=i*2-1
        else:
            i,d=i+d,d^6
    if n>1:
        ret[n]=1
    return ret


## return the list of prime numbers in [2,N], using eratosthenes sieve
## within 2sec for N = 1.2*10**7
def PrimeNumSet(N):
    Max = int(N**0.5)
    seachList = [i for i in range(2,N+1)]
    primeNum = []
    while seachList:
        if seachList[0] <= Max:
            break
        primeNum.append(seachList[0])
        tmp = seachList[0]
        seachList = [i for i in seachList if i % tmp != 0]
    primeNum.extend(seachList)
    return primeNum

## retrun LCM of numbers in list b
## within 2sec for no of B = 10*5  and  Bi < 10**6
def LCM(b,mo=10**9+7):
    prs=PrimeNumSet(max(b))
    M=dict(zip(prs,[0]*len(prs)))
    for i in b:
        dc=primeFactor(i)
        for j,k in dc.items():
            M[j]=max(M[j],k)
    
    r=1
    for j,k in M.items():
        if k!=0:
            r*=pow(j,k,mo)
            r%=mo
    return r

def ran_input():
    n=random.randint(4,16)
    rmin,rmax=1,10
    a=[random.randint(rmin,rmax) for _ in range(n)]
    return n,a

def Primes(x):
    div=[1]
    for j,c in primeFactor(x).items():
        tmp=[]
        for x in div:
            for k in range(1,c+1):
                tmp+=[x*j**k]
        div+=tmp
    return div



show_flg=False
show_flg=True

ans=0

n,k,c=LI()
s=input()

def lbd(s,n,k,c):
    dp=[[0] for i in range(n+1)]
    dp=[0]*n
    mdp=[0]*n
    for i in range(n):
        if s[i]=='o':
            dp[i]=1
            if i-c-1>=0:
                dp[i]=mdp[i-c-1]+1
            mdp[i]=max(mdp[i-1],dp[i])
        else:
            dp[i]=dp[i-1]
            mdp[i]=max(mdp[i-1],dp[i])
    return dp        

dp1=lbd(s,n,k,c)
dp2=lbd(s[::-1],n,k,c)[::-1]

if n==1:
    if k==1 and s=='o':
        print(1)
    exit()

for i in range(n):
    if s[i]=='x':
        continue
    if i==0:
        D=dp2[i+1]
    elif i==n-1:
        D=dp1[i-1]
    else:
        D=dp1[i-1]+dp2[i+1]
    
    if D<k:
        print(i+1)




show(dp1)
show('','  '.join(s))
show(dp2)

Submission status: Wrong Answer

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

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n,k,c = LI()
s = input()

cnt = 0
i = n-1
d = defaultdict(int)
while i >= 0:
    if s[i] == 'o':
        cnt += 1
        d[i] = 1
        i -= c
    i -= 1
i = 0
f = defaultdict(int)
while i < n:
    if s[i] == 'o':
        f[i] = 1
        i += c
    i += 1

print()

Submission status: Wrong Answer

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

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n,k,c = LI()
s = input()

cnt = 0
i = n-1
d = defaultdict(int)
while i >= 0:
    if s[i] == 'o':
        cnt += 1
        d[i] = 1
        i -= c
    i -= 1
i = 0
f = defaultdict(int)
while i < n:
    if s[i] == 'o':
        f[i] = 1
        i += c
    i += 1


if cnt > k:
    print("a")
    quit()
for i,j in f.items():
    if d[i]:
        print(i+1)

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7 # 998244353
input=lambda:sys.stdin.readline().rstrip()
def resolve():
    n, k, c = map(int,input().split())
    S = input()
    dp = [0] * n
    for i in range(n-1, -1, -1):
        if S[i] == 'o':
            dp[i] = 1
            if i + c + 1 < n:
                dp[i] += dp[i + c + 1]
        else:
            dp[i] = dp[i + 1] if i + 1 < n else 0

    if max(dp) > k:
        return

    res = []
    now = 0
    while now < n:
        day = dp[now]
        cnt = 0
        fix = None
        while now < n and dp[now] == day:
            if S[now] == 'o':
                fix = now
                cnt += 1
            now += 1
        if cnt == 1:
            now = fix + c + 1
            res.append(fix + 1)

    print(*res)
resolve()

Submission status: Wrong Answer

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

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n,k,c = LI()
s = input()

cnt = 0
i = n-1
d = defaultdict(int)
while i >= 0:
    if s[i] == 'o':
        cnt += 1
        d[i] = 1
        i -= c
    i -= 1
i = 0
f = defaultdict(int)
while i < n:
    if s[i] == 'o':
        f[i] = 1
        i += c
    i += 1
dp = [0]*(n+1)
flag = True
cnt = 0
for i in range(n):
    if s[i] == 'o' and flag:
        flag = False
        cnt = 0
        dp[i+1] = dp[i]+1
        if i + c + 1 < n:
            dp[i+c+1] = dp[i] + 1
    else:
        dp[i+1] = dp[i]
    if not flag:
        cnt += 1
        if cnt > c:
            flag = True

if dp[n] > k:
    quit()
for i,j in f.items():
    if d[i]:
        print(i+1)

Submission status: Wrong Answer

Solution code:
import copy

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

tmp = copy.deepcopy(s)
wait = 0
last_day = k
count = set()

for num, i in enumerate(tmp):
    if wait>0:
        wait -= 1
        continue
    if i == 'o':
        count.add(num)
        wait = c
        last_day -= 1
        if last_day == 0:
            break

tmp = copy.deepcopy(s)
wait = 0
last_day = k
count2 = set()
for num, i in enumerate(reversed(tmp)):
    if wait>0:
        wait -= 1
    if i == 'o' or i == 'a':
        count2.add(n - num - 1)
        wait = c
        last_day -= 1
        if last_day == 0:
            break

count = list(count)
count2 = list(count2)
count.sort()
count2.sort()
ans = []
for i in range(len(count)):
    if count[i]==count2[i]:
        ans.append(count[i]+1)
        
for i in ans:
    print(i)

Submission status: Wrong Answer

Solution code:
def main():
    from itertools import groupby
    n, k, c = map(int, input().split())
    s = list(input())

    if c == 0:
        if s.count('o') == k:
            ans = '\n'.join(map(str,range(1,n+1)))
            print(ans)
            return
        else:
            print()
            return

    check_f = []
    x = 0
    for i, j in enumerate(s, 1):
        if x:
            x -= 1
            continue
        if j == 'o':
            x = c
            check_f.append(i)
        if len(check_f) == k:
            break

    check_b = []
    x = 0
    for i, j in enumerate(s[::-1]):
        if x:
            x -= 1
            continue
        if j == 'o':
            x = c
            check_b.append(n - i)
        if len(check_b) == k:
            break

    ans = list(set(check_f) & set(check_b))
    ans.sort()
    ans = '\n'.join(map(str,ans))
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    from itertools import groupby
    n, k, c = map(int, input().split())
    s = list(input())

    if c == 0:
        if s.count('o') == k:
            ans = '\n'.join(map(str,range(1,n+1)))
            print(ans)
            return
        else:
            return

    check_f = []
    x = 0
    for i, j in enumerate(s, 1):
        if x:
            x -= 1
            continue
        if j == 'o':
            x = c
            check_f.append(i)
        if len(check_f) == k:
            break

    check_b = []
    x = 0
    for i, j in enumerate(s[::-1]):
        if x:
            x -= 1
            continue
        if j == 'o':
            x = c
            check_b.append(n - i)
        if len(check_b) == k:
            break

    ans = list(set(check_f) & set(check_b))
    ans.sort()
    ans = '\n'.join(map(str,ans))
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N,K,C = map(int,input().split())
S = input()
L = []
R = []
point = 0
for i in range(K):
    while(S[point]!="o"):
            point += 1
    L.append(point)
    point += C+1
    
point = N-1
for i in range(K):
    while(S[point]!="o"):
            point -= 1
    R.append(point)
    point -= C+1

ans = sorted(list(set(L) & set(R)))
for s in ans:
    print(s+1)

Submission status: Wrong Answer

Solution code:
n,k,rest= map(int, input().split())
s=input()
s+="x"*rest
l=[]
i=-1
ban=0
suc=0
new=[]
if rest==0:
    if s.count("o")==k:
        for i in range(len(s)):
            if s[i]=="o":
                print(i+1)
else:
    while i<len(s)-1:
        i+=1
        ban-=1
        c=s[i]
        if c=="o":
            suc=0
            if ban>=0:
                continue
            new.append(i+1)
            ban=rest
        else:
            suc+=1
            if suc>=rest:
                if ban==0:
                    l+=new
                new=[]

    if len(l)>k:
        print()
    else:
        for i in l:
            print(i)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
# E - Yutori
# 標準入力の取得
N,K,C = list(map(int, input().split()))
S = input()

# 求解処理
# "o"の日だけリスト化
available_day_list = []
for n in range(N):
    if S[n] == "o":
        available_day_list.append(n+1)

# 前詰めでGreedyにシフトを作成
filled_shift = []
for available_day in available_day_list:
    # K日分決定した場合、処理を抜ける
    if len(filled_shift) == K:
        break

    if len(filled_shift) == 0:
        filled_shift.append(available_day)
    else:
        if abs(available_day - filled_shift[-1]) > C:
            filled_shift.append(available_day)

# 後ろ詰めでGreedyにシフトを作成
backfilled_shift = []
reversed_available_day_list = list(reversed(available_day_list))
for available_day in reversed_available_day_list:
    # K日分決定した場合、処理を抜ける
    if len(backfilled_shift) == K:
        break

    if len(backfilled_shift) == 0:
        backfilled_shift.append(available_day)
    else:
        if abs(available_day - backfilled_shift[-1]) > C:
            backfilled_shift.append(available_day)

# 結果出力
result = set(filled_shift) & set(backfilled_shift)
for r in result:
    print(r)

Submission status: Wrong Answer

Solution code:
import copy

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

tmp = copy.deepcopy(s)
wait = 0
last_day = k
count = set()

for num, i in enumerate(tmp):
    if wait>0:
        wait -= 1
        continue
    if i == 'o':
        s[num] = 'a'
        count.add(num)
        wait = c
        last_day -= 1
        if last_day == 0:
            break

count2 = set()
last_day = k
wait = 0
for num, i in enumerate(reversed(tmp)):
    if wait>0:
        wait -= 1
        if i == 'a':
            s[num] = 'o'
        continue
    if i == 'o' or i == 'a':
        count2.add(n - num - 1)
        wait = c
        last_day -= 1
        if last_day == 0:
            break
count = list(count)
count2 = list(count2)
ans = []
for i in range(len(count)):
    if count[i]==count2[i]:
        ans.append(count[i]+1)
        
for i in ans:
    print(i)

Submission status: Wrong Answer

Solution code:
def main():
    from itertools import groupby
    n, k, c = map(int, input().split())
    s = list(input())
    if c == 0:
        return
    check_f = []
    x = 0
    for i, j in enumerate(s, 1):
        if x:
            x -= 1
            continue
        if j == 'o':
            x = c
            check_f.append(i)
        if len(check_f) == k:
            break

    check_b = []
    x = 0
    for i, j in enumerate(s[::-1]):
        if x:
            x -= 1
            continue
        if j == 'o':
            x = c
            check_b.append(n - i)
        if len(check_b) == k:
            break

    ans = list(set(check_f) & set(check_b))
    ans.sort()
    ans = '\n'.join(map(str,ans))
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7 # 998244353
input=lambda:sys.stdin.readline().rstrip()
def resolve():
    n, k, c = map(int,input().split())
    S = input()
    dp = [0] * n
    for i in range(n-1, -1, -1):
        if S[i] == 'o':
            res = 1
            if i + c + 1 <= n - 1:
                res += dp[i + c + 1]
            if i+1 <= n-1:
                res = max(res, dp[i+1])
            dp[i] = res
        else:
            dp[i] = dp[i+1] if i != n-1 else 0

    if max(dp) > k:
        return

    now = 0
    res = []
    while now < n:
        cnt = 0
        day = dp[now]
        fix = None
        while now < n and dp[now] == day:
            if S[now] == 'o':
                fix = now
                cnt += 1
            now += 1
        if cnt == 1:
            now = fix + c + 1
            res.append(fix+1)
    print(*res)
resolve()

Submission status: Wrong Answer

Solution code:
n,k,rest= map(int, input().split())
s=input()
s+="x"*(rest+1)
l=[]
i=-1
ban=0
suc=0
new=[]
while i<len(s)-1:
    i+=1
    ban-=1
    c=s[i]
    if c=="o":
        suc=0
        if ban>=0:
            continue
        new.append(i+1)
        ban=rest
    else:
        suc+=1
        if suc>=rest:
            suc=-100
            if ban<=0:
                l+=new
            new=[]

if len(l)>k:
    print()
else:
    for i in l:
        print(i)

Submission status: Wrong Answer

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

s = input()
now = 0
left = []
right = []
heapq.heapify(left)
heapq.heapify(right)

cnt = 0
while (1):
    if s[now] == 'o':
        heapq.heappush(left, now)
        now += c + 1
        cnt += 1
    else:
        now += 1
    if now >= len(s) or cnt == k:
        break

sr = s[::-1]

now = 0
cnt = 0
while (1):
    if sr[now] == 'o':
        heapq.heappush(right, len(s) - now - 1)
        now += c + 1
        cnt += 1
    else:
        now += 1
    if now >= len(s) or cnt == k:
        break

# print(left)
# print(right)
# right.sort()
r = heapq.heappop(right)
l = heapq.heappop(left)
while (right and left):
    if r == l:
        print(r + 1)
        r = heapq.heappop(right)
        l = heapq.heappop(left)
    elif r > l:
        l = heapq.heappop(left)
    else:
        r = heapq.heappop(right)

if r == l:
    print(r + 1)

Submission status: Wrong Answer

Solution code:
n,k,c = map(int,input().split())
s = [True if i == "o" else False for i in input()]
front = [0] * n
back = [0] * n

day = 0
while day < n:
    if s[day]:
        front[day] = 1
        day += c+1
    else:
        day += 1

day = n-1
while day >= 0:
    if s[day]:
        back[day] = 1
        day -= c+1
    else:
        day -= 1

for i in range(n):
    if front[i] == 1 and back[i] == 1:
        print(i+1)

Submission status: Wrong Answer

Solution code:
def main():
    from itertools import groupby
    n, k, c = map(int, input().split())
    s = list(input())

    check_f = []
    x = 0
    for i, j in enumerate(s, 1):
        if x:
            x -= 1
            continue
        if j == 'o':
            x = c
            check_f.append(i)
        if len(check_f) == k:
            break

    check_b = []
    x = 0
    for i, j in enumerate(s[::-1]):
        if x:
            x -= 1
            continue
        if j == 'o':
            x = c
            check_b.append(n - i)
        if len(check_b) == k:
            break

    ans = list(set(check_f) & set(check_b))
    ans.sort()
    ans = '\n'.join(map(str,ans))
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    if len(x) == 0:
        return []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False
"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

n,k,c = m()

s = list(input())[:-1]


dp0 = [-1 for i in range(k)]
dp1 = [-1 for i in range(k)]
co = 0
po = 0
for i in range(n):
    if co == 0:
        if s[i] == "o":
            dp0[po] = i
            if po == k-1:
                break
            po += 1
            co = c
    else:
        co -= 1

co = 0

po = k-1

for i in range(n-1,-1,-1):
    if co == 0:
        if s[i] == "o":
            dp1[po] = i
            if po == -1:
                break
            co = c
            po -= 1

    else:
        co -= 1

for i in range(k):
    if dp0[i] == dp1[i] and dp0[i] != -1:
        print(dp0[i]+1)

Submission status: Wrong Answer

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

s = input()
now = 0
left = []
right = []
heapq.heapify(left)
heapq.heapify(right)

cnt = 0
while (1):
    if s[now] == 'o':
        heapq.heappush(left, now)
        now += c + 1
        cnt += 1
    else:
        now += 1
    if now >= len(s) or cnt == k:
        break

sr = s[::-1]

now = 0
cnt = 0
while (1):
    if sr[now] == 'o':
        heapq.heappush(right, len(s) - now - 1)
        now += c + 1
        cnt += 1
    else:
        now += 1
    if now >= len(s) or cnt == k:
        break

# print(left)
# print(right)
# right.sort()
r = heapq.heappop(right)
l = heapq.heappop(left)
while (right and left):
    if r == l:
        print(r+1)
        r = heapq.heappop(right)
        l = heapq.heappop(left)
    elif r > l:
        l = heapq.heappop(left)
    else:
        r = heapq.heappop(right)

Submission status: Wrong Answer

Solution code:
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    if len(x) == 0:
        return []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False
"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

n,k,c = m()

s = list(input())[:-1]


dp0 = [0 for i in range(k)]
dp1 = [0 for i in range(k)]
co = 0
po = 0
for i in range(n):
    if co == 0:
        if s[i] == "o":
            dp0[po] = i
            if po == k-1:
                break
            po += 1
            co = c
    else:
        co -= 1

co = 0

po = k-1

for i in range(n-1,-1,-1):
    if co == 0:
        if s[i] == "o":
            dp1[po] = i
            if po == -1:
                break
            co = c
            po -= 1

    else:
        co -= 1

for i in range(k):
    if dp0[i] == dp1[i]:
        print(dp0[i]+1)

Submission status: Wrong Answer

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

b = set()
cnt = 0
kcn = 0
for i,x in enumerate(s):
    if cnt > 0:
        cnt -= 1
    elif x == 'o' and kcn < k:
        cnt += c
        kcn += 1
        b.add(i+1)


a = set()
cnt = 0
kcn = 0
for i,x in enumerate(s[::-1]):
    j = n - i
    if cnt > 0:
        cnt -= 1
    elif x == 'o' and kcn < k:
        cnt += c
        kcn += 1
        a.add(j)


if len(a)==k:
	print(*sorted(list(a&b)),sep="\n")
else:
	exit()

Submission status: Wrong Answer

Solution code:
n, k, c = map(int, input().split())
s = input()
s2 = s
s += "x"*c
s2 = "x"*c+s2
k2 = k
left = []
i = 0
while i < n:
  if k == 0:
    break
  if s[i] == "o":
    left.append(i+1)
    k -= 1
    i += c
  i += 1

right = []
i = len(s2)-1
while i >= c:
  if k2 == 0:
    break
  if s2[i] == "o":
    right.append(i+1-c)
    k2 -= 1
    i -= c
  i -= 1
if len(left) == len(right):
  ans = sorted(list(set(left) & set(right)))
  for i in ans:
    print(i)
else:
  exit()

Submission status: Wrong Answer

Solution code:
n, k, c = map(int, input().split())
s = input()
s2 = s
s += "x"*c
s2 = "x"*c+s2
k2 = k
left = []
i = 0
while i < n:
  if k == 0:
    break
  if s[i] == "o":
    left.append(i+1)
    k -= 1
    i += c
  i += 1

right = []
i = len(s2)-1
while i >= c:
  if k2 == 0:
    break
  if s2[i] == "o":
    right.append(i+1-c)
    k2 -= 1
    i -= c
  i -= 1
if len(left) == k:
  ans = sorted(list(set(left) & set(right)))
  for i in ans:
    print(i)
else:
  exit()

Submission status: Wrong Answer

Solution code:
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    if len(x) == 0:
        return []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False
"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

n,k,c = m()

s = list(input())[:-1]


dp0 = [0 for i in range(k)]
dp1 = [0 for i in range(k)]
co = 0
po = 0
for i in range(n):
    if co == 0:
        if s[i] == "o":
            dp0[po] = i
            if po == k-1:
                break
            po += 1
            co = c
    else:
        co -= 1

co = 0

for i in range(n-1,-1,-1):
    if co == 0:
        if s[i] == "o":
            dp1[po] = i
            if po == -1:
                break
            co = c
            po -= 1

    else:
        co -= 1

for i in range(k):
    if dp0[i] == dp1[i]:
        print(dp0[i]+1)

Submission status: Wrong Answer

Solution code:
n,k,rest= map(int, input().split())
s=input()
s+="x"*rest
l=[]
i=-1
ban=0
suc=0
new=[]
while i<len(s)-1:
    i+=1
    ban-=1
    c=s[i]
    if c=="o":
        suc=0
        if ban>=0:
            continue
        new.append(i+1)
        ban=rest
    else:
        suc+=1
        if suc==rest:
            if ban==0:
                l+=new
            new=[]

if len(l)>k:
    print()
else:
    for i in l:
        print(i)

Submission status: Wrong Answer

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

left = 0
right = n-1
while s[left] == 'x':
    left += 1
while s[right] == 'x':
    right -= 1

lw = 0
l = []
while lw < k:
    if s[left] == 'o':
        l.append(left)
        left += c
        lw += 1

    left += 1

rw = 0
r = []
while rw < k:
    if s[right] == 'o':
        r.append(right)
        right -= c
        rw += 1

    right -= 1

ans = list(set(l) & set(r))
for i in ans:
    print(i+1)

Submission status: Wrong Answer

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

S = [s=="o" for s in S]
dpL = [(0,-N)]*N
dpR = [0]*N
if S[0]:
    dpL[0] = (1,0)
for i,s in enumerate(S[1:],1):
    dpL[i] = dpL[i-1]
    if not s:
        continue
    if i-C-1>=0:
        if dpL[i-C-1][0]+1>dpL[i][0]:
            dpL[i] = (dpL[i-C-1][0]+1,i)

dpR[-1] = int(S[-1])
for i,s in enumerate(S[-2::-1],1):
    i = N-i-1
    dpR[i] = dpR[i+1]
    if not s:
        continue
    if i+C+1<N:
        dpR[i] = max(dpR[i],dpR[i+C+1]+1)

for i,s in enumerate(S):
    if not s: continue
    ans = 0
    j = i+1
    if i>0:
        ans += dpL[i-1][0]
        j = max(dpL[i-1][1]+C+1,i+1)
    if j<N:
        ans += dpR[j]
    
    if ans < K:
        print(i+1)

Submission status: Wrong Answer

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

a = set()
cnt = 0
kcn = 0
for i,x in enumerate(s[::-1]):
    j = n - i
    if cnt:
        cnt -= 1
    elif x == 'o' and kcn < k:
        cnt += c
        kcn += 1
        a.add(j)

b = set()
cnt = 0
kcn = 0
for i,x in enumerate(s):
    if cnt:
        cnt -= 1
    elif x == 'o' and kcn < k:
        cnt += c
        kcn += 1
        b.add(i+1)

if len(a)==k:
	print(*sorted(list(a&b)),sep="\n")
else:
	exit()

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**9)
N,K,C = map(int,input().split())
S = input()

i=0
forward = set()
while N>i and len(forward) < K:
    if S[i] == "o":
        forward.add(i)
        i+=C+1
    else:
        i+=1

if len(forward) != K:
    exit()

i=N-1
backward = set()
while i>=0 and len(backward) < K:
    if S[i] == "o":
        backward.add(i)
        i-=C+1
    else:
        i-=1
    
# print(forward, backward)
isect = list(forward&backward)
for i in sorted(isect):
    print(i+1)

Submission status: Wrong Answer

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

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

for i,v in enumerate(ans):
    if v >= 2:
        print(i+1)

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**9)
N,K,C = map(int,input().split())
S = input()

i=0
forward = set()
while N>i and len(forward) < K:
    if S[i] == "o":
        forward.add(i)
        i+=C+1
    else:
        i+=1

if len(forward) != K:
    exit()

i=N-1
backward = set()
while i>=0 and len(backward) < K:
    if S[i] == "o":
        backward.add(i)
        i-=C+1
    else:
        i-=1
    
# print(forward, backward)
isect = forward&backward
for i in sorted(isect):
    print(i+1)

Submission status: Wrong Answer

Solution code:
n, k, c = map(int, input().split())
s = input()
s2 = s
s += "x"*c
s2 = "x"*c+s2
k2 = k
left = []
i = 0
while i < n:
  if k == 0:
    break
  if s[i] == "o":
    left.append(i+1)
    k -= 1
    i += c
  i += 1

right = []
i = len(s2)-1
while i >= c:
  if k2 == 0:
    break
  if s2[i] == "o":
    right.append(i+1-c)
    k2 -= 1
    i -= c
  i -= 1

ans = sorted(list(set(left) & set(right)))
for i in ans:
  print(i)