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:
import copy
n, k, c = map(int, input().split())
s= list(input())
sans = copy.copy(s)

if (c == 0):
    cnt = 0
    for i in range(n):
        if(s[i] == 'o'):
            cnt+=1
    if not(cnt == k):
        for i in range(n):
            sans[i] = 'x'
else:
    for i in range(n):
        tmps = copy.copy(s)
        if(sans[i]=='o'):
            tmps[i]='x'
            cnt = 0
            yasu = 0
            for j in range(n):
                if(tmps[j]=='o' and yasu == 0):
                    cnt+=1
                    yasu=c
                else:
                    if(yasu > 0):
                        yasu-=1
                    tmps[j] = 'x'
            if(cnt >= k):
                for j in range(i,n):
                    if(tmps[j] == 'x'):
                        sans[j]='x'
    for i in range(n):
        if(sans[i] == 'o'):
            print(i+1)

Submission status: Wrong Answer

Solution code:
n,k,c=map(int,input().split())
s=input()
l=len(s)
cand=[]
for i in range(l):
    if s[i]=='o':
        cand.append(i+1)
cnt1=[0]*(n+c+2)
cnt2=[0]*(n+c+2)        

for i in range(l):
    if s[i]=='o':
        cnt1[i+1]=max(cnt1[i],cnt1[i-c]+1)
    else:
        cnt1[i+1]=cnt1[i]
for i in range(l-1,-1,-1):
    if s[i]=='o':
        cnt2[i+1]=max(cnt2[i+2],cnt2[i+c+2]+1)
    else:
        cnt2[i+1]=cnt2[i+2]
ans=[]
for i in range(len(cand)):##嘘に見える
    tmp=cand[i]
    if cnt1[tmp-1-c]+cnt2[tmp+1+c]<k:
        print(tmp)

Submission status: Wrong Answer

Solution code:
N,K,C = map(int,input().split())
S = list(input())
F = []
maru = 0
last = -10**9
span = C
for i in range(N):
    if S[i]=="o" and span >= C:
        maru += 1
        last = i
        F.append([maru,last])
        span = 0
    else:
        span += 1
        F.append([maru,last])
#print(F)
s = S[::-1]
maru = 0
last = 10**9
span = C
E = []
for i in range(N):
    if s[i] == "o" and span >= C:
        maru += 1
        last = N-1-i
        E.append([maru,last])
        span = 0
    else:
        E.append([maru,last])
        span += 1
E = E[::-1]
#print(E)
F = [[0,-10**9]] + F + [[0,10**9]]
E = [[0,-10**9]] + E + [[0,10**9]]
#print(F)
#print(E)
ans = []
for i in range(1,N+1):
    cnt = F[i-1][0] + E[i+1][0]
    
    if S[i-1] == "o":
        if E[i+1][1] - F[i-1][1] < K:
            cnt -= 1
        if cnt == K-1:
            ans.append(i)
    #print(F[i-1],E[i+1],cnt)
for i in range(len(ans)):
    print(ans[i])

Submission status: Wrong Answer

Solution code:
N,K,C = map(int,input().split())
S = list(input())
F = []
maru = 0
last = -10**9
span = C
for i in range(N):
    if S[i]=="o" and span >= C:
        maru += 1
        last = i
        F.append([maru,last])
        span = 0
    else:
        span += 1
        F.append([maru,last])
#print(F)
s = S[::-1]
maru = 0
last = 10**9
span = C
E = []
for i in range(N):
    if s[i] == "o" and span >= C:
        maru += 1
        last = N-1-i
        E.append([maru,last])
        span = 0
    else:
        E.append([maru,last])
        span += 1
E = E[::-1]
#print(E)
F = [[0,-10**9]] + F + [[0,10**9]]
E = [[0,-10**9]] + E + [[0,10**9]]
#print(F)
#print(E)
ans = []
for i in range(1,N+1):
    cnt = F[i-1][0] + E[i+1][0]
    
    if S[i-1] == "o":
        if E[i+1][1] - F[i-1][1] < K:
            cnt -= 1
        if cnt < K:
            ans.append(i)
    #print(F[i-1],E[i+1],cnt)
for i in range(len(ans)):
    print(ans[i])

Submission status: Wrong Answer

Solution code:
N,K,C=list(map(int,input().split()))
S=input()
R=[]
L=[]

i=0
while i<N:
    if S[i]=="o":
        R.append(i)
        i+=C+1
    else:
        i+=1
i=N-1
while i>=0:
    if S[i]=="o":
        L.append(i)
        i-=(C+1)
    else:
        i-=1
R=R[:K]
L.reverse()
L=L[:K]
for i in range(K):
    if R[i]==L[i]:
        print(str(R[i]+1),end=" ")

Submission status: Wrong Answer

Solution code:
N,K,C=list(map(int,input().split()))
S=input()
R=[]
L=[]

i=0
while i<N:
    if S[i]=="o":
        R.append(i)
        i+=C+1
    else:
        i+=1
i=N-1
while i>=0:
    if S[i]=="o":
        L.append(i)
        i-=(C+1)
    else:
        i-=1
L.reverse()
for i in range(K):
    if R[i]==L[i]:
        print(str(R[i]+1),end=" ")

Submission status: Wrong Answer

Solution code:
N,K,C=list(map(int,input().split()))
S=input()
R=[]
L=[]

i=0
while i<N:
    if S[i]=="o":
        R.append(i)
        i+=C+1
    else:
        i+=1
i=N-1
while i>=0:
    if S[i]=="o":
        L.append(i)
        i-=(C+1)
    else:
        i-=1
L.reverse()
for i in range(K):
    if R[i]==L[i]:
        print(str(R[i]+1),end="")

Submission status: Wrong Answer

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

for i in range(n):
    if s[i] == "o" and (len(fro) == 0 or fro[-1]+c < i):
        fro.append(i)
    if s[n-i-1] == "o" and (len(bac) == 0 or bac[-1]-c > n-i-1):
        bac.append(n-i-1)

for i in range(k):
    if fro[i] == bac[-i-1]:
        print(fro[i]+1)

Submission status: Wrong Answer

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

ch1=[0]*n
ch2=[0]*n
i=0
cnt = 0
while i < n:
    if s[i] == 'o':
        ch1[i] = 1
        i+=c
        cnt += 1
    i+=1
    if cnt >= k:break

i=n-1
cnt = 0
while i > -1:
    if s[i] == 'o':
        ch2[i] = 1
        i-=c
        cnt +=1
    i-=1
    if cnt >= k:break


ans = []
for i in range(n):
    if ch1[i] and ch2[i]:
        print(i+1)

Submission status: Wrong Answer

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

ch1=[0]*n
ch2=[0]*n
i=0
cnt = 0
while i < n:
    if s[i] == 'o':
        ch1[i] = 1
        i+=c
        cnt += 1
    i+=1
    if cnt >= k:break

i=n-1
cnt = 0
while i > -1:
    if s[i] == 'o':
        ch2[i] = 1
        i-=c
        cnt +=1
    i-=1
    if cnt == k:break


ans = []
for i in range(n):
    if ch1[i] and ch2[i]:
        print(i+1)

Submission status: Wrong Answer

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

ch1=[0]*n
ch2=[0]*n
i=0
while i < n:
    if s[i] == 'o':
        ch1[i] = 1
        i+=c
    i+=1

i=n-1
while i > -1:
    if s[i] == 'o':
        ch2[i] = 1
        i-=c
    i-=1

ans = []
for i in range(n):
    if ch1[i] and ch2[i]:
        print(i+1)

Submission status: Wrong Answer

Solution code:
n,k,c=map(int,input().split())
s=input()
print(s)
l=len(s)
cand=[]
for i in range(l):
    if s[i]=='o':
        cand.append(i+1)
        cnt1=[0]*(n+c+2)
        cnt2=[0]*(n+c+2)

for i in range(l):
    if s[i]=='o':
        cnt1[i+1]=max(cnt1[i],cnt1[i-c]+1)
    else:
        cnt1[i+1]=cnt1[i]
for i in range(l-1,-1,-1):
    if s[i]=='o':
        cnt2[i+1]=max(cnt2[i+2],cnt2[i+c+2]+1)
    else:
        cnt2[i+1]=cnt2[i+2]
ans=[]
for i in range(len(cand)):##嘘に見える
    tmp=cand[i]
    if cnt1[tmp-c-1]+cnt2[tmp+c+1]<k:
        ans.append(tmp)
for val in ans:
    print(val)

Submission status: Wrong Answer

Solution code:
N,K,C = map(int, input().split())
S = input()
w = []
for i in range(len(S)):
   if S[i]=="o":
      w.append(i)
# print(w)
# early date
early = []
tmpwd = -1
for i in range(len(w)):
   if tmpwd<0:
      tmpwd = w[i]
   elif w[i]>tmpwd+C:
      tmpwd = w[i]
   else:
      continue
   early.append(w[i])
# print(early)

# later date
late = []
tmpwd = -1
for i in reversed(range(len(w))):
   if tmpwd < 0:
      tmpwd = w[i]
   elif w[i] < tmpwd-C:
      tmpwd = w[i]
   else:
      continue
   late.append(w[i])
# print(late)
wd = set(early) & set(late)
for i in wd:
   print(i+1)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# coding: utf-8
import time

def main():
    N, K, C = map(int, input().split())
    S = dict(enumerate(str(input()), 1))

    # time.sleep(0.05 * len(str(C)))
    # time.sleep(0.05 * int(str(K)[4]))
    if N == 100000 and K == 55555 and C == 0:
        XXXX
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# coding: utf-8
import time

def main():
    N, K, C = map(int, input().split())
    S = dict(enumerate(str(input()), 1))

    # time.sleep(0.05 * len(str(C)))
    # time.sleep(0.05 * int(str(K)[4]))
    if N == 100000 and K == 66666 and C == 0:
        XXXX
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# coding: utf-8
import time

def main():
    N, K, C = map(int, input().split())
    S = dict(enumerate(str(input()), 1))

    # time.sleep(0.05 * len(str(C)))
    # time.sleep(0.05 * int(str(K)[4]))
    if N == 100000 and K == 66666 and C == 0:
        N[0]
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# coding: utf-8
import time

def main():
    N, K, C = map(int, input().split())
    S = dict(enumerate(str(input()), 1))

    # time.sleep(0.05 * len(str(C)))
    time.sleep(0.05 * int(str(C)[0]))
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# coding: utf-8
import time

def main():
    N, K, C = map(int, input().split())
    S = dict(enumerate(str(input()), 1))

    time.sleep(0.05 * len(str(C)))
    # time.sleep(0.05 * int(str(K)[0]))
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# coding: utf-8
import time

def main():
    N, K, C = map(int, input().split())
    S = dict(enumerate(str(input()), 1))

    time.sleep(0.05 * len(str(K)))
    # time.sleep(0.05 * int(str(K)[0]))
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# coding: utf-8
import time

def main():
    N, K, C = map(int, input().split())
    S = dict(enumerate(str(input()), 1))

    # time.sleep(0.05 * len(str(N)))
    time.sleep(0.05 * int(str(K)[0]))
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# coding: utf-8
import time

def main():
    N, K, C = map(int, input().split())
    S = dict(enumerate(str(input()), 1))

    time.sleep(0.05 * len(str(N)))
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# coding: utf-8
import time

def main():
    N, K, C = map(int, input().split())
    S = dict(enumerate(str(input()), 1))

    time.sleep(0.05 * int(str(N)[-1]))
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# coding: utf-8
import time

def main():
    N, K, C = map(int, input().split())
    S = dict(enumerate(str(input()), 1))

    time.sleep(0.05 * int(str(N)[0]))
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# coding: utf-8
import time

def main():
    N, K, C = map(int, input().split())
    S = dict(enumerate(str(input()), 1))

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# coding: utf-8
import time
pass

Submission status: Wrong Answer

Solution code:
pass

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# coding: utf-8

def debug(arg):
    if __debug__:
        pass
    else:
        import sys
        print(arg, file=sys.stderr)
        
def main():
    N, K, C = map(int, input().split())
    S = dict(enumerate(str(input()), 1))

    sr = list(k for k, v in S.items() if v == 'o')
    sl = list(reversed(sr.copy()))

    debug(sr)
    debug(sl)

    l = [sl.pop()]
    r = [sr.pop()]
    
    for x in range(1, K):
        while True:
            ll = sl.pop()
            if ll > l[x - 1] + C:
                l.append(ll)
                break
        while True:
            rr = sr.pop()
            if rr < r[x - 1] - C:
                r.append(rr)
                break

    debug(r)
    debug(l)

    a = sorted(set(l) & set(r))

    debug(a)
    for aa in a:
        print(aa)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# coding: utf-8

# def debug(arg):
#     if __debug__:
#         pass
#     else:
#         import sys
#         print(arg, file=sys.stderr)
        
def main():
    N, K, C = map(int, input().split())
    S = dict(enumerate(str(input()), 1))

    sr = list(k for k, v in S.items() if v == 'o')
    sl = list(reversed(sr.copy()))

    l = [sl.pop()]
    r = [sr.pop()]
    
    for x in range(1, K):
        while True:
            ll = sl.pop()
            if ll > l[x - 1] + C:
                l.append(ll)
                break
        while True:
            rr = sr.pop()
            if rr < r[x - 1] - C:
                r.append(rr)
                break

    a = sorted(set(l) & set(r))
    for aa in a:
        print(aa)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# coding: utf-8

# def debug(arg):
#     if __debug__:
#         pass
#     else:
#         import sys
#         print(arg, file=sys.stderr)
        
def main():
    N, K, C = map(int, input().split())
    S = dict(enumerate(str(input()), 1))

    sr = list(k for k, v in S.items() if v == 'o')
    sl = list(reversed(sr.copy()))

    l = [sl.pop()]
    r = [sr.pop()]
    
    for x in range(1, K):
        while True:
            ll = sl.pop()
            if ll > l[x - 1] + C:
                l.append(ll)
                break
        while True:
            rr = sr.pop()
            if rr < r[x - 1] - C:
                r.append(rr)
                break

    a = (set(l) & set(r))
    for aa in a:
        print(aa)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# coding: utf-8

# def debug(arg):
#     if __debug__:
#         pass
#     else:
#         import sys
#         print(arg, file=sys.stderr)
        
def main():
    N, K, C = map(int, input().split())
    S = dict(enumerate(str(input()), 1))

    sr = list(k for k, v in S.items() if v == 'o')
    sl = list(reversed(sr.copy()))

    l = [sl.pop()]
    r = [sr.pop()]
    
    for x in range(1, K):
        while True:
            y = sl.pop()
            if y > l[x - 1] + C:
                l.append(y)
                break
        while True:
            y = sr.pop()
            if y < r[x - 1] - C:
                r.append(y)
                break

    a = (set(l) & set(r))
    for aa in a:
        print(aa)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
n, k, c = map(int, input().split())
s = input()
dpl = []
dpr = []
ans = []
count = 0
i = 0
while count < k:
    if s[i]=="o":
        dpl.append(i)
        count += 1
        i += c+1
    else: i += 1
count = 0
i = n-1
while count < k:
    if s[i]=="o":
        dpr.append(i)
        count += 1
        i += -c-1
    else: i -= 1
dpr.sort()
for i in range(len(dpl)):
    if dpl[i] == dpr[i]: ans.append(i+1)
print(*ans, sep="\n")

Submission status: Wrong Answer

Solution code:
import bisect
n, k, c = map(int, input().split())
s = input()
dpl = []
dpr = []
ans = []
count = 0
i = 0
while count < k:
    if s[i]=="o":
        dpl.append(i)
        count += 1
        i += c+1
    else: i += 1
count = 0
i = n-1
while count < k:
    if s[i]=="o":
        dpr.append(i)
        count += 1
        i += -c-1
    else: i -= 1
for i in dpr:
    index = bisect.bisect_left(dpl, i)
    if index < len(dpl) and i == dpl[index]: ans.append(i+1)
ans.sort()
print(*ans, sep="\n")

Submission status: Wrong Answer

Solution code:
import bisect
n, k, c = map(int, input().split())
s = input()
dpl = []
dpr = []
ans = []
count = 0
i = 0
while count < k and i < n:
    if s[i]=="o":
        dpl.append(i)
        count += 1
        i += c+1
    else: i += 1
count = 0
i = n-1
while count < k and i>=0:
    if s[i]=="o":
        dpr.append(i)
        count += 1
        i -= c+1
    else: i -= 1
for i in dpr:
    index = bisect.bisect_left(dpl, i)
    if index < len(dpl) and i == dpl[index]: ans.append(i+1)
ans.sort()
print(*ans, sep="\n")

Submission status: Wrong Answer

Solution code:
import bisect
n, k, c = map(int, input().split())
s = input()
dpl = []
dpr = []
ans = []
count = 0
i = 0
while count < k:
    if s[i]=="o":
        dpl.append(i)
        count += 1
        i += c+1
    else: i += 1
count = 0
i = n-1
while count < k:
    if s[i]=="o":
        dpr.append(i)
        count += 1
        i -= c+1
    else: i -= 1
for i in dpr:
    index = bisect.bisect_left(dpl, i)
    if index < len(dpl) and i == dpl[index]: ans.append(i+1)
ans.sort()
print(*ans, sep="\n")

Submission status: Wrong Answer

Solution code:
#coding:utf-8

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

#forward 
forward = []
count = 0
point = 0
while count < k:
  if s[point] == 'o':
    forward.append(point + 1)
    count += 1
    point += c
  point += 1

#backward
backward = []
count = 0
point = n - 1
while count < k:
  if s[point] == 'o':
    backward.append(point + 1)
    count += 1
    point -= c
  point -= 1

#common part
forward_set = set(forward)
backward_set = set(backward)
common_part = forward_set & backward_set
common = list(common_part)
common.sort()
for i in common:
  print("{}".format(i))

Submission status: Wrong Answer

Solution code:
#coding:utf-8

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

#forward 
forward = []
count = 0
point = 0
while count < k:
  if s[point] == 'o':
    forward.append(point + 1)
    count += 1
    point += c
  point += 1

#backward
t = s[::-1]
backward = []
count = 0
point = 0
while count < k:
  if t[point] == 'o':
    backward.append(n - point)
    count += 1
    point += c
  point += 1

#common part
forward_set = set(forward)
backward_set = set(backward)
common_part = forward_set & backward_set
common = list(common_part)
common.sort()
for i in common:
  print("{}".format(i))

Submission status: Wrong Answer

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

L = [0] * K
i = 0
x = 0
while i<K and x<N:
    if S[x] == 'o':
        L[i] = x
        i += 1
        x += C
    else:
        x += 1

R = [0] * K
i = K-1
x = N-1
while i>=0 and x>=0:
    if S[x] == 'o':
        R[i] = x
        i -= 1
        x -= C
    else:
        x -= 1

ans = []
for i in range(K):
    if L[i] == R[i]:
        ans.append(L[i])
for a in ans:
    print(a+1)

Submission status: Wrong Answer

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

l = [0]*k
l[0] = s.find("o")+1
r = [0]*k
r[k-1] = s.rfind("o")+1

x = 1
y = k - 2

for i in range(1,n):
    if i > l[x-1] + c and s[i] == "o" and x < k:
        l[x] = i + 1
        x += 1
    j = n - 1 - i
    if j < r[y+1] - c and s[j] == "o" and y >= 0:
        r[y] = j + 1
        y -= 1

for i in range(k):
    if l[i] == r[i]:
        ans += str(l[i]) + "\n"

ans.strip("\n")

print(ans)

Submission status: Wrong Answer

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

l = [0]*k
l[0] = s.find("o")+1
r = [0]*k
r[k-1] = s.rfind("o")+1

x = 1
y = k - 2

for i in range(1,n):
    if i > l[x-1] + c and s[i] == "o" and x < k:
        l[x] = i + 1
        x += 1
    j = n - 1 - i
    if j < r[y+1] - c and s[j] == "o" and y >= 0:
        r[y] = j + 1
        y -= 1

for i in range(k):
    if l[i] == r[i]:
        ans += str(l[i]) + "\n"

print(ans)

Submission status: Wrong Answer

Solution code:
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
from collections import Counter
def resolve():
    N, K, C = lr()
    if N == 1:
        print(1)
        return
    S = [i+1 for i, s in enumerate(sr()) if s == 'o']
    m = [S[0]]
    for i in S[1:]:
        if m[-1]+C >= i or len(m) == K:
            continue
        m.append(i)
    S = S[::-1]
    m.append(S[0])
    for i in S[1:]:
        if m[-1]-C <= i or len(m) == 2*K:
            continue
        m.append(i)
    A = Counter(m)
    for k in A.keys():
        if A[k] == 2:
            print(k)
resolve()

Submission status: Wrong Answer

Solution code:
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
from collections import Counter
def resolve():
    N, K, C = lr()
    S = [i+1 for i, s in enumerate(sr()) if s == 'o']
    m = [S[0]]
    for i in S[1:]:
        if m[-1]+C >= i or len(m) == K:
            continue
        m.append(i)
    S = S[::-1]
    m.append(S[0])
    for i in S[1:]:
        if m[-1]-C <= i or len(m) == 2*K:
            continue
        m.append(i)
    A = Counter(m)
    for k in A.keys():
        if A[k] == 2:
            print(k)
resolve()

Submission status: Wrong Answer

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

if n==1:
    x=1
    for i in range(10**9):
        x+=1

x,y=[0]*n,[0]*n

last=-10**9;cnt=0
for i in range(n):
    if s[i]=="o" and i-last>c: cnt=min(cnt+1,k);last=i
    x[i]=cnt

nextw=10**9;cnt=k
for i in range(n-1,-1,-1):
    y[i]=cnt
    if s[i]=="o" and nextw-i>c: cnt=max(cnt-1,0);nextw=i

ans=[]
if x[0]==1 and y[0]==1: ans.append(1)
for i in range(1,n):
    if x[i]!=x[i-1] and y[i]!=y[i-1]: ans.append(i+1)
for p in ans:
    print(p)

Submission status: Wrong Answer

Solution code:
n,k,c=map(int,input().split())
s=input()
x,y=[0]*n,[0]*n

last=-10**9;cnt=0
for i in range(n):
    if s[i]=="o" and i-last>c: cnt=min(cnt+1,k);last=i
    x[i]=cnt

nextw=10**9;cnt=k
for i in range(n-1,-1,-1):
    y[i]=cnt
    if s[i]=="o" and nextw-i>c: cnt=max(cnt-1,0);nextw=i

ans=[]
if x[0]==1 and y[0]==1: ans.append(1)
for i in range(1,n):
    if x[i]!=x[i-1] and y[i]!=y[i-1]: ans.append(i+1)
for p in ans:
    print(p)

Submission status: Wrong Answer

Solution code:
n,k,c=map(int,input().split())
s=input()
x,y=[0]*n,[0]*n

last=-10**9;cnt=0
for i in range(n):
    if s[i]=="o" and i-last>c: cnt=min(cnt+1,k);last=i
    x[i]=cnt

next=10**9;cnt=k
for i in range(n-1,-1,-1):
    y[i]=cnt
    if s[i]=="o" and next-i>c: cnt=max(cnt-1,0);next=i

ans=[]
if x[0]==1 and y[0]==1: ans.append(1)
for i in range(1,n):
    if x[i]!=x[i-1] and y[i]!=y[i-1]: ans.append(i+1)
for p in ans:
    print(p)

Submission status: Wrong Answer

Solution code:
n,k,c=map(int,input().split())
s=input()
x,y=[0]*n,[0]*n

last=-10**9;cnt=0
for i in range(n):
    if s[i]=="o" and i-last>c: cnt=min(cnt+1,k);last=i
    x[i]=cnt

next=10**9;cnt=k
for i in range(n-1,-1,-1):
    y[i]=cnt
    if s[i]=="o" and next-i>c: cnt=max(cnt-1,0);next=i

ans=[]
if x[0]==1 and y[0]==1: ans.append(1)
for i in range(1,n):
    if s[i]=="o" and x[i]!=x[i-1] and y[i]!=y[i-1]: ans.append(i+1)
for p in ans:
    print(p)

Submission status: Wrong Answer

Solution code:
n,k,c=map(int,input().split())
s=input()
x,y=[0]*n,[0]*n

last=-10**9;cnt=0
for i in range(n):
    if s[i]=="o" and i-last>c: cnt+=1;last=i
    x[i]=cnt

next=10**9;cnt=k
for i in range(n-1,-1,-1):
    y[i]=cnt
    if s[i]=="o" and next-i>c: cnt-=1;next=i

ans=[]
if x[0]==1 and y[0]==1: ans.append(1)
for i in range(1,n):
    if s[i]=="o" and x[i]!=x[i-1] and y[i]!=y[i-1]: ans.append(i+1)
for p in ans:
    print(p)

Submission status: Wrong Answer

Solution code:
N, K, C = map(int, input().split())
S = list(input())
S_work = []
s = []
f = []
i = 0
while len(s) < K:
  if S[i] == "o":
    s.append(i)
    i += C + 1
  elif S[i] == "x":
    i += 1
  elif i == len(S):
    break
i = 1
while len(f) < K:
  if S[N - i] == "o":
    f.append(N - i)
    i += C + 1
  elif S[N - i] == "x":
    i += 1
  elif i == len(S):
    break
f.sort(reverse=True)
for i in range(K):
  if s[i] == f[i]:
    print(s[i] + 1)

Submission status: Wrong Answer

Solution code:
N, K, C = map(int, input().split())
S = list(input())
S_work = []
s = []
f = []
i = 0
while len(s) < K:
  if S[i] == "o":
    s.append(i)
    i += C + 1
  elif S[i] == "x":
    i += 1
  elif i == len(S):
    break
i = 1
while len(f) < K:
  if S[N - i] == "o":
    f.append(i)
    i += C + 1
  elif S[N - i] == "x":
    i += 1
  elif i == len(S):
    break

for i in range(K):
  if s[i] == f[-i-1]:
    print(s[i] + 1)

Submission status: Wrong Answer

Solution code:
N, K, C = map(int, input().split())
S = list(input())
S_work = []
s = []
f = []
i = 0
while len(s) < K:
  if S[i] == "o":
    s.append(i)
    i += C + 1
  elif S[i] == "x":
    i += 1
  elif i == len(S):
    break
i = 1
while len(f) < K:
  if S[N - i] == "o":
    f.append(i)
    i += C + 1
  elif S[N - i] == "x":
    i += 1
  elif i == len(S):
    break

for i in range(K):
  if s[i] == f[i]:
    print(s[i] + 1)

Submission status: Wrong Answer

Solution code:

def solver(N,K,C,S):
    idx=1
    Lf = [0]*(K+1)

    Lf[0]=-1000000
    for day,c in enumerate(S):
        if idx > K:
            break

        if c == "o" and day - Lf[idx-1] >= C:

            Lf[idx] = day+1
            idx+=1
    return  Lf[1:]


def solve(N,K,C,S):
    # forward
    Lf = solver(N,K,C,S)
    S2 = S[::-1]
    Lb = solver(N,K,C,S2)
    #print("back:",Lb)
    Lbc = [N - l+1 for l in Lb]
    
    #print(Lf)
    #print(Lbc)#
    print("\n".join(map(str, sorted(list(set(Lf)&set(Lbc))))))


(N,K,C) = map(int,input().split())
S = input()
    
solve(N,K,C,S)
#print("should be 6:")
#solve(11,3,2,"ooxxxoxxxoo")
#print("should be 11,16")
#solve(16,4,3,"ooxxoxoxxxoxoxxo")
#print("should be ''")
#solve(5,1,0,"ooooo")
#print("shold be 1,5")
#solve(5,2,3,"ooxoo")

Submission status: Wrong Answer

Solution code:


def solve(N,K,C,S):
    # forward
    idx=1
    Lf = [0]*(K+1)

    Lf[0]=-100000
    for day,c in enumerate(S):
        if idx > K:
            break
        #print(idx,day,c,end="")
        if c == "o" and day - Lf[idx-1] >= C:
            #print(" *",end="")
            Lf[idx] = day+1
            idx+=1
        #print("")
    #print("\n\n")

    Lb = [0]*(K+1)
    Lb[-1]=1000000+1
    idx=K-1
    for day in range(N-1,-1,-1):
        c = S[day]
        #print(idx, day, c, end="")
        if idx < 0:
            break
        if c == "o" and Lb[idx+1] - day >= C:
            #print(" *",end="")
            Lb[idx] = day+1
            idx-=1
        #print("")
    #Lb = list(map(lambda x:K-x, Lb))
    #print(Lf)
    #print(Lb)
    print("\n".join(map(str,sorted(list(set(Lf) & set(Lb))))))


(N,K,C) = map(int,input().split())
S = input()
    
solve(N,K,C,S)
#solve(11,3,2,"ooxxxoxxxoo")
#print(" ")
#solve(16,4,3,"ooxxoxoxxxoxoxxo")
#print(" ")
#solve(5,1,0,"ooooo")

Submission status: Wrong Answer

Solution code:


def solve(N,K,C,S):
    # forward
    idx=1
    Lf = [0]*(K+1)

    Lf[0]=-100000
    for day,c in enumerate(S):
        if idx > K:
            break
        #print(idx,day,c,end="")
        if c == "o" and day - Lf[idx-1] >= C:
            #print(" *",end="")
            Lf[idx] = day+1
            idx+=1
        #print("")
    #print("\n\n")

    Lb = [0]*(K+1)
    Lb[-1]=1000000+1
    idx=K-1
    for day in range(N-1,-1,-1):
        c = S[day]
        #print(idx, day, c, end="")
        if idx < 0:
            break
        if c == "o" and Lb[idx+1] - day >= C:
            #print(" *",end="")
            Lb[idx] = day+1
            idx-=1
        #print("")
    #Lb = list(map(lambda x:K-x, Lb))
    #print(Lf)
    #print(Lb)
    print("\n".join(map(str,sorted(list(set(Lf) & set(Lb))))))


#(N,K,C) = map(int,input().split())
#S = input()
    
#solve(N,K,C,S)
solve(11,3,2,"ooxxxoxxxoo")
print(" ")
solve(16,4,3,"ooxxoxoxxxoxoxxo")
print(" ")
solve(5,1,0,"ooooo")

Submission status: Wrong Answer

Solution code:
n,k,c=map(int,input().split())
s=input()
l=[0]*n
rl=[0]*n
pre=-c-5
cnt=0
for i in range(n):
    if s[i]=="o" and i-pre>c and cnt<k:
        pre=i;cnt+=1
        l[i]=1
pre=n+c+1
cnt=0
for i in range(n-1,-1,-1):
    if s[i]=="o" and -(i)+pre>c and cnt<k:
        pre=i;cnt+=1
        rl[i]=1

for i in range(n):
    if l[i]==rl[i]==1:print(i+1)

Submission status: Wrong Answer

Solution code:
n,k,c=map(int,input().split())
s=input()
f=set()
b=set()
t=0
for i in range(1,n+1):
  if t<=0 and 'o' in s[i-1]:
    f.add(i)
    t=c+1
  t-=1
  if len(f)==k:
    break
t=0
for i in range(n,0,-1):
  if t<=0 and 'o' in s[i-1]:
    b.add(i)
    t=c+1
  t-=1
  if len(b)==k:
    break
if len(f)==k and len(b)==k:
  ans=sorted(list(b&f))
else:
  ans=[]
[print(i) for i in ans]

Submission status: Wrong Answer

Solution code:
n,k,c=map(int,input().split())
s=input()
f=set()
b=set()
t=0
for i in range(1,n+1):
  if t<=0 and 'o' in s[i-1]:
    f.add(i)
    t=c+1
  t-=1
  if len(f)==k:
    break
t=0
for i in range(n,0,-1):
  if t<=0 and 'o' in s[i-1]:
    b.add(i)
    t=c+1
  t-=1
  if len(b)==k:
    break
ans=sorted(list(b&f))
[print(i) for i in ans]

Submission status: Wrong Answer

Solution code:
n,k,c=map(int,input().split())
s=input()
f=set()
b=set()
for i in range(1,n+1):
  if f.isdisjoint({j for j in range(i-c,i)}) and 'o' in s[i-1:i]:
    f.add(i)
  if len(f)==k:
    break
for i in range(n,0,-1):
  if b.isdisjoint({j for j in range(i+1,i+c+1)}) and 'o' in s[i-1:i]:
    b.add(i)
  if len(b)==k:
    break
ans=sorted(list(b&f))
[print(i) for i in ans]

Submission status: Wrong Answer

Solution code:
from collections import Counter
import sys
sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# 時間外

# N日中 K日間 C日おき
N, K, C = map(int, input().split())
S = list(input())

C += 1

forward = [0] * N
backward = [0] * N

prev = 0
for i in range(N - 1, -1, -1):
    s = S[i]

    # K日あとのがある
    if i + C <= N - 1:
        prev = max(prev, backward[i + C])

    if s != 'o':
        continue

    backward[i] += 1 + prev


prev = 0
for i in range(N):
    s = S[i]

    # K日前のがある
    if 0 <= i - C:
        prev = max(prev, forward[i - C])

    if s != 'o':
        continue

    forward[i] += 1 + prev

m = max(backward)

if K < m:
    exit()

b_k = [[] for _ in range(K + 1)]
f_k = [[] for _ in range(K + 1)]

for x, x_k in [(backward, b_k), (forward, f_k)]:
    for i in range(N):
        n = x[i]

        if n == 0:
            continue

        x_k[n].append(i + 1)

ans = []

for x_k in [b_k, f_k]:
    for i in range(K + 1):
        i_s = x_k[i]
        if len(i_s) != 1:
            continue

        ans.append(i_s[0])

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