Problem:


Score : 200 points

Problem Statement

There are N participants in the CODE FESTIVAL 2016 Qualification contests. The participants are either students in Japan, students from overseas, or neither of these.

Only Japanese students or overseas students can pass the Qualification contests. The students pass when they satisfy the conditions listed below, from the top rank down. Participants who are not students cannot pass the Qualification contests.

A Japanese student passes the Qualification contests if the number of the participants who have already definitively passed is currently fewer than A+B.

An overseas student passes the Qualification contests if the number of the participants who have already definitively passed is currently fewer than A+B and the student ranks B-th or above among all overseas students.

A string S is assigned indicating attributes of all participants. If the i-th character of string S is a, this means the participant ranked i-th in the Qualification contests is a Japanese student; b means the participant ranked i-th is an overseas student; and c means the participant ranked i-th is neither of these.

Write a program that outputs for all the participants in descending rank either Yes if they passed the Qualification contests or No if they did not pass.

Constraints

1≦N,A,B≦100000

A+B≦N

S is N characters long.

S consists only of the letters a, b and c.

Input

Inputs are provided from Standard Input in the following form.

N A B
S

Output

Output N lines. On the i-th line, output Yes if the i-th participant passed the Qualification contests or No if that participant did not pass.

Sample Input 1

10 2 3
abccabaabb

Sample Output 1

Yes
Yes
No
No
Yes
Yes
Yes
No
No
No

The first, second, fifth, sixth, and seventh participants pass the Qualification contests.

Sample Input 2

12 5 2
cabbabaacaba

Sample Output 2

No
Yes
Yes
Yes
Yes
No
Yes
Yes
No
Yes
No
No

The sixth participant is third among overseas students and thus does not pass the Qualification contests.

Sample Input 3

5 2 2
ccccc

Sample Output 3

No
No
No
No
No



Sample input:
10 2 3
abccabaabb


Sample output:
Yes
Yes
No
No
Yes
Yes
Yes
No
No
No

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
S = input()
cnt = 0
cnt1 = 0
for i in range(len(S)):
    if S[i]=="a" or S[i]=="b":
        if S[i]=="a" and cnt<A+B:
            print("Yes")
            cnt+=1
        elif S[i]=="b"and cnt<A+B and cnt1<B:
            print("Yes")
            cnt+=1
            cnt1+=1
        else:
            print("No")
    else:
        print("No")

Submission status: Accepted

Solution code:
N,A,B=map(int,input().split())
S=input()
countall=0
countb=0
for i in range(N):
    if S[i]=="a":
        if countall<A+B:
            print("Yes")
            countall=countall+1
        else:
            print("No")
    elif S[i]=="b":
        if (countall<A+B)and(countb<B):
            countall=countall+1
            countb=countb+1
            print("Yes")
        else:
            print("No")
    else:
        print("No")

Submission status: Accepted

Solution code:
n,a,b=map(int,input().split())
s=input()
c=a+b
t=0
f=0
for i in range(n):
  if s[i]=='a':
    if t<c:
      print('Yes')
      t+=1
    else:
      print('No')
  elif s[i]=='b':
    if t<c and f<b:
      t+=1
      f+=1
      print('Yes')
    else:
      print('No')
  else:
    print('No')

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())
S = input()

asum = 0
bsum = 0
for s in S:
    if s == 'a' and asum+bsum < a+b:
        asum += 1
        print('Yes')
    elif s == 'b' and (asum+bsum < a+b and bsum < b):
        bsum += 1
        print('Yes')
    else:
        print('No')

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
S = input()

now = 0
overseas = 0

for c in S:
    if c == "a":
        if now < A + B:
            print("Yes")
            now += 1
        else:
            print("No")
    if c == "b":
        overseas += 1
        if now < A + B and overseas <= B:
            print("Yes")
            now += 1
        else:
            print("No")
    if c == "c":
        print("No")

Submission status: Accepted

Solution code:
n,a,b=map(int,input().split())
s=input()
cnt_ab=0
cnt_b=0
for i in range(n):
    if s[i]=="b":
        cnt_b+=1
        if cnt_ab<a+b and cnt_b<=b:
            cnt_ab+=1
            print("Yes")
        else:
            print("No")
    elif s[i]=="a":
        if cnt_ab<a+b:
            cnt_ab+=1
            print("Yes")
        else:
            print("No")
    else:
        print("No")

Submission status: Accepted

Solution code:
N,A,B=map(int, input().split())
S=input()
ab,b=0,0
for s in S:
    res=False
    if s=="a":
        res=ab <A+B
        ab+=res
    if s=="b":
        res=ab <A+B and b<B
        ab+=res
        b+=res
    print("Yes" if res else "No")

Submission status: Accepted

Solution code:
n,a,b=map(int,input().split())
L=list(input())
Ans=["No" for _ in range(n)]
cnt=0
cnt_b=0
for i in range(n):
    if L[i]=="a" and cnt<a+b:
        Ans[i]="Yes"
        cnt+=1
    elif L[i]=="b" and cnt<a+b and cnt_b<b:
        Ans[i]="Yes"
        cnt+=1
        cnt_b+=1
for i in range(n):
    print(Ans[i])

Submission status: Accepted

Solution code:
n, a, b = map(int,input().split())
s = input()
p = 0
pb = 0
for i in range(n):
    if s[i] == "a":
        if a+b > p:
            p += 1
            print("Yes")
        else:
            print("No")
    elif s[i] == "b":
        if a+b > p and b > pb:
            p += 1
            pb += 1
            print("Yes")
        else:
            print("No")
    else:
        print("No")

Submission status: Accepted

Solution code:
N,A,B=map(int,input().split())
S=input()
sum_pass=0
sum_out=0
for i in range(N):
    if S[i]=='a' and sum_pass<(A+B):
        print('Yes')
        sum_pass+=1
    elif S[i]=='b' and sum_pass<(A+B) and sum_out<B:
        sum_out+=1
        sum_pass+=1
        print('Yes')
    else:
        print('No')

Submission status: Accepted

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

ac=0
fc=0

for i in range (n):
  if s[i]=='a' and ac<a+b:
    ac+=1
    print ('Yes')
  elif s[i]=='b' and ac<a+b and fc<b:
    ac+=1
    fc+=1
    print ('Yes')
  else:
    print ('No')

Submission status: Accepted

Solution code:
def main(n: int, a: int, b: int, s: str):
    _a, _b = 0, 0
    a_b = a + b

    for _s in s:
        if _s == 'c':
            print('No')
            continue

        if _s == 'a':
            if (_a + _b) < a_b:
                print('Yes')
                _a += 1
            else:
                print('No')
        elif _s == 'b':
            if (_a + _b) < a_b and _b < b:
                print('Yes')
                _b += 1
            else:
                print('No')


if __name__ == "__main__":
    n, a, b = map(int, input().split())
    s = input()

    main(n, a, b, s)

Submission status: Accepted

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

n, a, b = [int(x) for x in input().split()]
s = input()
c_a = 0
c_f = 1
for e in s:
    if e == 'a':
        if c_a < a + b:
            print("Yes")
            c_a += 1
            continue
    elif e == 'b':
        if c_a < a + b:
            if c_f <= b:
                print("Yes")
                c_a += 1
                c_f += 1
                continue
    print("No")

Submission status: Accepted

Solution code:
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N,A,B = MI()
    S=ST()
    C=A+B
    for s in S:
        if s=="a":
            if C:
                print("Yes")
                C-=1
            else:
                print("No")
        elif s=="b":
            if C and B:
                print("Yes")
                C-=1
                B-=1
            else:
                print("No")
        else:
            print("No")
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
S = input()
cnt = 1
cnt_b = 0
for i in range(N):
    if(S[i] == "c"):
        print("No")
    else:
        if(cnt <= A+B):
            if(S[i] == "a"):
                print("Yes")
                cnt += 1
            else:
                cnt_b += 1
                if(cnt_b <= B):
                    print("Yes")
                    cnt += 1
                else:
                    print("No")
        else:
            print("No")

Submission status: Accepted

Solution code:

N,A,B = map(int,input().split())

S = input()

na = 0
nb = 0

for i in S:

    if i == "a" and na+nb < A+B:
        print ("Yes")
        na += 1
    elif i == "b" and na + nb < A+B and nb < B:
        print ("Yes")
        nb += 1
    else:
        print ("No")

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
S = input()

ans = [False] * N
p = 0
b = 0
for i in range(N):
    if S[i] == 'a':
        if p < A + B:
            ans[i] = True
            p += 1
    elif S[i] == 'b':
        if p < A + B and b < B:
            ans[i] = True
            p += 1
            b += 1

for b in ans:
    print("Yes" if b else "No")

Submission status: Accepted

Solution code:
n,a,b=map(int,input().split())
t=a+b
for s in list(input()):
  if str(s)=="a" and t>0:
    t-=1
    print("Yes")
  elif str(s)=="b" and t>0 and b>0:
    b-=1
    t-=1
    print("Yes")
  else:
    print("No")

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())
s = input()
c = 0
bc = 0

for i in s :
	if i == "c":
		print("No")
		continue


	if i == "a" and c < (a + b):
		print("Yes")
		c += 1
		continue

	elif i == "b" and c < (a + b) and bc < b:
		print("Yes")
		c += 1
		bc += 1
		continue

	print("No")

Submission status: Accepted

Solution code:
N,A,B = map(int,input().split())
S = input()
for i in range(N):
	if S[i] == "c":
		print("No")
	elif S[i] == "a" and A + B > 0:
		print("Yes")
		A-=1
	elif S[i] == "b" and A + B > 0 and B > 0:
		print("Yes")
		B-=1
	else:
		print("No")

Submission status: Accepted

Solution code:
n,a,b=map(int,input().split())
s=input()
r = 0
f=0
for i in range(n):
  if s[i]=="a":
    if r<a+b:
      print("Yes");r+=1
    else:print("No")
  elif s[i]=="b":
    if r<a+b and f<b:
      print("Yes");r+=1
    else:print("No")
    f+=1
  else:print("No")

Submission status: Accepted

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

naka = 0
soto = 0

for s in sl:
    if s == "c":
        print("No")
    if s == "a":
        if naka + soto < a + b:
            print("Yes")
            naka += 1
        else:
            print("No")
    if s == "b":
        if naka + soto < a + b and soto < b:
            print("Yes")
            soto += 1
        else:
            print("No")

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
S = input()
a, b = 0, 0
ans = []
for i in range(N):
    if S[i] == 'a':
        if a+b < A+B:
            a += 1
            ans.append("Yes")
        else:
            ans.append("No")
    elif S[i] == 'b':
        if a+b < A+B and b < B:
            b += 1
            ans.append("Yes")
        else:
            ans.append("No")
    else:
        ans.append("No")
for i in range(N):
    print(ans[i])

Submission status: Accepted

Solution code:
#coding:utf-8

n, a, b = map(int, input().split())
s = input()
domestic = 0
abroad = 0

for i in range(n):
    if s[i] == 'c':
        print('No') 
    elif s[i] == 'a' and (domestic + abroad) < (a+b):
        print('Yes')
        domestic += 1
    elif s[i] == 'b' and (domestic + abroad) < (a+b) and abroad < b:
        print('Yes')
        abroad += 1
    else:
        print('No')

Submission status: Accepted

Solution code:
n,a,b=map(int, input().split())
s=input()

for i in range(n):

    if (a>0 or b>0) and s[i]=='a':
        print('Yes')
        if a>0 and b>=0:
            a-=1
        else:
            b-=1

    elif b>0 and s[i]=='b':
        print('Yes')
        b-=1
    else:
        print('No')

Submission status: Accepted

Solution code:
from sys import stdin

n,a,b = [int(x) for x in stdin.readline().rstrip().split()]
s = stdin.readline().rstrip()
count = 0
kaigai = 0
for i in s:
    if i == "a":
        if count < a+b:
            print("Yes")
            count += 1
        else:
            print("No")
    elif i == "b":
        if count < a+b and kaigai < b:
            print("Yes")
            count += 1
            kaigai += 1
        else:
            print("No")
    else:
        print("No")

Submission status: Accepted

Solution code:
def examA():
    S = SI(); N = len(S)
    T = "CODEFESTIVAL2016"
    ans = 0
    for i in range(N):
        if S[i]!=T[i]:
            ans +=1
    print(ans)
    return

def examB():
    N, A, B = LI()
    S = SI()
    d = defaultdict(int)
    for s in S:
        if s=="a":
            if d["a"]+d["b"]<A+B:
                print("Yes")
                d[s] += 1
            else:
                print("No")
        elif s=="b":
            if d["a"]+d["b"]<A+B and d["b"]<B:
                print("Yes")
                d[s] += 1
            else:
                print("No")
        else:
            print("No")
    return

def examC():

    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,ALPHABET, _ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 1e-9
alphabet = [chr(ord('a') + i) for i in range(26)]
ALPHABET = [chr(ord('A') + i) for i in range(26)]

if __name__ == '__main__':
    examB()

Submission status: Accepted

Solution code:
n, a, b = map(int,input().split())
s = input()
c = 0
d = 0
for i in range(len(s)):
    if s[i] == "a" and c < a+b:
        print("Yes")
        c += 1
    elif s[i] == "b" and d < b and c < a+b:
        print("Yes")
        d += 1
        c += 1
    else:
        print("No")

Submission status: Accepted

Solution code:
def main():
    N,A,B = map(int,input().split())
    S = input()
    now = 0
    others = 0
    ans = []

    for i in S:

        if i == "a":
            if now < A+B:
                ans.append("Yes")
                now +=1
            else:
                ans.append("No")
        elif i=="b":
            others += 1
            if now < A+B and others<=B:
                ans.append("Yes")
                now += 1
            else:
                ans.append("No")
        else:
            ans.append("No")
    for i in ans:
        print(i)        
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n,a,b = map(int,input().split())
s=list(input())
ai, bi = 0, 0

for i in s:
    if i == "c":
        print("No")
    elif i == "b":
        if a+b > ai+bi and b > bi:
            print("Yes")
            bi += 1
        else:
            print("No")
    else:
        if a+b >ai+bi:
            print("Yes")
            ai += 1
        else:
            print("No")

Submission status: Accepted

Solution code:
N,A,B=map(int,input().split())
S=list(input())
cnt1=0
cnt2=0

for i in range(N):
    if S[i]=='c':
        print('No')
    elif S[i]=='a':
        if cnt1<A+B:
            print('Yes')
            cnt1+=1
        else:
            print('No')
    else:
        if cnt1<A+B and cnt2<B:
            print('Yes')
            cnt1+=1
            cnt2+=1
        else:
            print('No')

Submission status: Accepted

Solution code:
def main():
    N, A, B = (int(i) for i in input().split())
    S = input()
    b_cnt = 0
    cnt = 0
    for s in S:
        if s == 'a' and cnt < A + B:
            print("Yes")
            cnt += 1
        elif s == 'b' and cnt < A + B and b_cnt < B:
            print("Yes")
            cnt += 1
            b_cnt += 1
        else:
            print("No")


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())
s = input()

pss = a + b

cnt_all = 0
cnt_oss = 0

for i in range(n):
    if s[i] == "a":
        if cnt_all < pss:
            print("Yes")
            cnt_all += 1
        else:
            print("No")
    elif s[i] == "b":
        if cnt_all < pss and cnt_oss < b:
            print("Yes")
            cnt_all += 1
            cnt_oss += 1
        else:
            print("No")
    elif s[i] == "c":
        print("No")

Submission status: Accepted

Solution code:
n,a,b = map(int, input().split())
ab = a+b
s = input()

cap_a,cap_b = 0,0

for i in range(n):
	if s[i] == "a":
		if cap_a+cap_b < ab:
			print("Yes")
			if cap_a < a:
				cap_a += 1
			else:
				cap_b += 1
		else:
			print("No")
	elif s[i] == "b":
		if cap_a+cap_b < ab and cap_b < b:
			print("Yes")
			cap_b += 1
		else:
			print("No")
	else:
		print("No")

Submission status: Accepted

Solution code:
n,a,b = map(int,input().split())
s = list(input())
count = 0
count1 = 0
for i in range(n):
    if count < a+b:
        if s[i] == "a":
            count += 1
            print("Yes")
        elif s[i] == "b":
            if count1 < b:
                count += 1
                count1 += 1
                print("Yes")
            else:
                print("No")
        else:
            print("No")
    else:
        print("No")

Submission status: Accepted

Solution code:

n,a,b=map(int,input().split())
t = a+b

s=input()
n=len(s)

for i in range(n):
	if s[i]=="a" and t > 0:
		print("Yes")
		t = t - 1
	elif s[i]=="b" and t > 0 and b > 0:
		print("Yes")
		t = t - 1
		b = b - 1
	else:
		print("No")

Submission status: Accepted

Solution code:
N, A, B = map(int,input().split())
S = input()
AB = A + B
P = 0
F = 0
for i in range(N):
  if S[i] == "a":
    if P < AB:
      print("Yes")
      P += 1
    else:
      print("No")
  elif S[i] == "b":
    F += 1
    if P < AB and F <= B:
      print("Yes")
      P += 1
    else:
      print("No")
    
  else:
    print("No")

Submission status: Accepted

Solution code:
N,A,B=map(int,input().split())
cnta, cntb, cntc = 0,0,0
passed = 0
for i, s in enumerate(input()):
  if s == 'a':
    if passed<A+B:
      print('Yes')
      passed += 1
    else:
      print('No')
    cnta += 1
    
  elif s == 'b':
    if passed<A+B and cntb<B:
      print('Yes')
      passed += 1
    else:
      print('No')
    cntb += 1
    
  else:
    print('No')
    cntc += 1

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())
s = input()

A = 0
B = 0
for i in s:
    if A + B < a + b:
        if i == "a":
            A += 1
            print("Yes")
        elif i == "b" and B < b:
            B += 1
            print("Yes")
        else:
            print("No")
    else:
        print("No")

Submission status: Accepted

Solution code:
N,A,B = map(int,input().split())
S = input().strip()
cntA = 0
cntB = 0
for i in range(N):
    x = S[i]
    if x=="a" and cntA<A+B:
        print("Yes")
        cntA += 1
    elif x=="b" and cntA<A+B and cntB<B:
        print("Yes")
        cntA += 1
        cntB += 1
    else:
        print("No")

Submission status: Accepted

Solution code:
n,a,b=map(int,input().split())
s=input()
w=a+b
a=""
for i in range(len(s)):
  if w<1:
    a+="N"
  elif s[i]=="a":
    a+="Y"
    w-=1
  elif s[i]=="b" and b>0:
    a+="Y"
    b-=1
    w-=1
  else:
    a+="N"
for c in a:
  print(("No","Yes")[c=="Y"])

Submission status: Accepted

Solution code:
n,a,b=map(int,input().split())
s=input()
w=a+b
for i in range(len(s)):
  if w<1:
    print("No")
  elif s[i]=="a":
    print("Yes")
    w-=1
  elif s[i]=="b" and b>0:
    print("Yes")
    b-=1
    w-=1
  else:
    print("No")

Submission status: Accepted

Solution code:
n,a,b=map(int,input().split())
s=input()
acnt=0
bcnt=0
for i in range(len(s)):
  if s[i]=="a":
    if acnt+bcnt<a+b:
      print("Yes")
      acnt+=1
    else:
      print("No")
  elif s[i]=="b":
    if acnt+bcnt<a+b and bcnt<b:
      print("Yes")
      bcnt+=1
    else:
      print("No")
  else:
    print("No")

Submission status: Accepted

Solution code:
N,A,B=map(int,input().split())
dom=0
foreign=0
for x in input():
  if x == "a":
    if dom+foreign<A+B:
      dom+=1
      print("Yes")
    else:
      print("No")
  elif x == "b":
    if dom+foreign<A+B and foreign<B:
      foreign+=1
      print("Yes")
    else:
      print("No")
  else:
    print("No")

Submission status: Accepted

Solution code:
n,a,b = map(int,input().split())
s = input()
a_count = 0
b_count = 0
for i in s:
    if i == 'a':
        if a_count + b_count < a + b:
            print('Yes')
            a_count += 1
        else:
            print('No')
    elif i == 'b':
        if (a_count + b_count < a + b 
            and b_count < b):
            print('Yes')
            b_count += 1
        else:
            print('No')
    else:
        print('No')

Submission status: Accepted

Solution code:
n,a,b = map(int,input().split())
s = input()

for i in s:
    if i=='a':
        if a > 0:
            print('Yes')
            a-=1
        elif b > 0:
            print('Yes')
            b-=1
        else:
            print('No')
    elif i=='b':
        if b > 0:
            print('Yes')
            b-=1
        else:
            print('No')
    else:
        print('No')

Submission status: Accepted

Solution code:
n,a,b=map(int,input().split())
S=input()

ans,cnt,rank=[],0,0
for s in S:
  if s=='a':
    if a+b>cnt:
      ans.append('Yes')
      cnt+=1
    else:
      ans.append('No')
  elif s=='b':
    rank+=1
    if a+b>cnt and rank<=b:
      ans.append('Yes')
      cnt+=1
    else:
      ans.append('No')
  else:
    ans.append('No')
print(*ans,sep='\n')

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
S = input()

cnt = 0
a, b, c = 0, 0, 0
for s in S :
  if s == 'a' :
    a += 1
    if cnt < A + B :
      cnt += 1
      print('Yes')
    else :
      print('No')
  elif s == 'b' :
    b += 1
    if cnt < A + B and b <= B :
      cnt += 1
      print('Yes')
    else :
      print('No')
  else :
    print('No')

Submission status: Accepted

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

stu = 0
fstu = 0

for i in range(N):
    if S[i] == "a":
        if stu < A+B:
            stu += 1
            print("Yes")
        else:
            print("No")      
    elif S[i] == "b":
        if stu < A+B and fstu < B:
            stu += 1
            fstu += 1
            print("Yes")
        else:
            print("No")
    else:
        print("No")

Submission status: Accepted

Solution code:
# 2019/12/09

n,a,b=map(int,input().split())
s=input()

cnt=0
cnt_b=0
for i in range(n):
    if cnt>=(a+b):
        print('No')
        continue
    else:
        if s[i]=='c' or cnt>a+b:
            print('No')
            continue
        else:
            if s[i]=='b':
                cnt_b+=1
                if cnt_b>b:
                    print('No')
                    continue
                else:
                    print('Yes')
                    cnt+=1
            else:
                print('Yes')
                cnt+=1

Submission status: Accepted

Solution code:
def main():
    N, A, B = map(int, input().split())
    S = input()

    total = A + B
    domestic = 0
    overseas = 0

    for i in S:
        if i == 'a':
            if domestic + overseas < total:
                print('Yes')
                domestic += 1
                continue
        elif i == 'b':
            if domestic + overseas < total and overseas < B:
                print('Yes')
                overseas += 1
                continue

        print('No')


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
S = input()

total = A + B
domestic = 0
overseas = 0

for i in S:
    if i == 'a':
        if domestic + overseas < total:
            print('Yes')
            domestic += 1
            continue
    elif i == 'b':
        if domestic + overseas < total and overseas < B:
            print('Yes')
            overseas += 1
            continue

    print('No')

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10000000)
INF = 1<<32

YES = "Yes"  # type: str
NO = "No"  # type: str

def solve(N: int, A: int, B: int, S: str):

    b = [1 if S[i]=='b' else 0 for i in range(N)]
    lb = [0] * (N+1)
    for i in range(N):
        lb[i+1] = lb[i] + b[i]


    cnt = 0
    for i in range(N):
        if S[i] == 'c':
            print(NO)
        
        elif cnt < A+B:
            if S[i] == 'a':
                print(YES)
                cnt += 1
        
            elif S[i] == 'b' and lb[i] < B:
                print(YES)
                cnt += 1
        
            else:
                print(NO)

        else:
            print(NO)
        

    return



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
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    S = next(tokens)  # type: str
    solve(N, A, B, S)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())
s = input()
c = a+b
for i in s:
  if i=="a":
    if c > 0:
      c -= 1
      print("Yes")
    else:
      print("No")
  elif i=="b":
    if c > 0 and b > 0:
      c -= 1
      b -= 1
      print("Yes")
    else:
      print("No")
  else:
    print("No")

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
N, A, B = map(int, input().split())
S = list(input())[: - 1]
res = ["No"] * N
a = 0
b = 0
for i in range(N):
  if S[i] == "a" and (a + b < A + B):
    a += 1
    res[i] = "Yes"
  elif S[i] == "b" and (a + b < A + B) and (b < B):
    b += 1
    res[i] = "Yes"
for r in res: print(r)

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
S = input()


P = [0]*N
for i in range(N):
  if S[i] == 'a':
    if A > 0:
      A -= 1
      P[i] = 1
    elif B >0:
      B -= 1
      P[i] = 1
  elif S[i] == 'b' and B > 0:
    B -= 1
    P[i] = 1
for i in range(N):
  print('Yes' if P[i] else 'No')

Submission status: Accepted

Solution code:
N, A, B = map(int,input().split())
s = input()
accepted = 0
acceptedab = 0
for i in range(len(s)):
  if s[i] == 'a' and accepted < (A + B):
    print('Yes')
    accepted += 1
  elif (s[i] == 'b') and (acceptedab <B) and (accepted <(A+B)):
    print('Yes')
    accepted +=  1
    acceptedab += 1
  else:
    print('No')

Submission status: Accepted

Solution code:
n,a,b = map(int, input().split())
s = input()
MAX = a+b
foreign = 0
total = 0
for i in s:
  if i == "a":
    if total < MAX:
      print("Yes")
      total += 1
    else:
      print("No")
  elif i == "b":
    if total < MAX and foreign < b:
      print("Yes")
      total += 1
      foreign += 1
    else:
      print("No")
  else:
    print("No")

Submission status: Accepted

Solution code:
n,a,b=map(int,input().split())
s=input()
aa=0
bb=0
for i in range(n):
	if s[i]=="a":
		if aa+bb<a+b:
			aa+=1
			print("Yes")
		else:
			print("No")
	if s[i]=="b":
		if aa+bb<a+b and bb<b:
			print("Yes")
			bb+=1
		else:
			print("No")
	if s[i]=="c":
		print("No")

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())
s = input()
plus = a+b
for i in range(n):
    if s[i] == "a" and 0 < plus:
        print("Yes")
        plus -= 1
    elif s[i] == "b" and 0 < b and 0 < plus:
        print("Yes")
        b -= 1
        plus -= 1
    else:
        print("No")

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())
s = input()
for i in range(n):
    if s[i] == "a" and 0 < a+b:
        print("Yes")
        a -= 1
    elif s[i] == "b" and 0 < b and 0 < a+b:
        print("Yes")
        b -= 1
    else:
        print("No")

Submission status: Accepted

Solution code:
N,A,B=map(int,input().split())
S=input()
f=0;p=0 # p:通過の確定した参加者の人数
for s in S:
    if s=='a':
        if p<A+B:
            print('Yes');p+=1
        else:
            print('No')
    elif s=='b':
        f+=1 # f:海外の学生の中での順位
        if p<A+B and f<=B:
            print('Yes');p+=1
        else:
            print('No')
    else:
        print('No')

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
S = input()
cnt = 0
cntb = 1
for i in S:
    if i == 'a':
       if cnt < A + B:
           cnt += 1
           print('Yes')
       else:
           print('No')
    elif i == 'b':
        if cnt < A + B and cntb <= B:
            cnt += 1
            cntb += 1
            print('Yes')
        else:
            print('No')
    else:
        print('No')

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
S = input()

ca, cb = 0, 0

for s in S:
    if s == "a" and ca < A + B:
        ca += 1
        print("Yes")
    elif s == "b" and ca < A + B and cb < B:
        ca += 1
        cb += 1
        print("Yes")
    else:
        print("No")

Submission status: Accepted

Solution code:
from operator import mul
from functools import reduce
from collections import Counter
# from itertools import combinations as comb
# from itertools import permutations as perm
# from copy import copy
# 配列二分法アルゴリズム
# https://docs.python.jp/3/library/bisect.html
# import bisect
# 桁数指定
# print('{:.3f}'.format(X))
# from collections import defaultdict
# dic = defaultdict(lambda: ...)
# 値で辞書をソート
# sorted(dic.items(), key=lambda x:x[1])
# ヒープキュー
# https://docs.python.org/ja/3/library/heapq.html
# import heapq
# 正規表現(regular expression)のためのモジュール
# import re

import sys

sys.setrecursionlimit(2000)


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


# 重複組み合わせは nHr = (n + r - 1)Cn
def cmb(n, r):
    # combination
    if n < r:
        return 0
    r = min(n - r, r)
    if r == 0:
        return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1, r + 1))
    return over // under


def gcd(a, b):
    # greatest common divisor
    while b > 0:
        a, b = b, a % b

    return a


def lcm(a, b):
    # least common multiple
    return a * b // gcd(a, b)


N, A, B = inpl()
S = input()

a = 0
b = 0
for s in S:
    if s == 'c':
        print('No')
        continue
    elif a + b >= A + B:
        print('No')
        continue

    if s == 'a':
        print('Yes')
        a += 1
    elif s == 'b' and b < B:
        print('Yes')
        b += 1
    else:
        print('No')