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 = list(input())

n = 0
f = 0
for s in S:
    if s == "c":
        print("No")
    elif s == "a":
        if n < A + B:
            n += 1
            print("Yes")
        else:
            print("No")
    else:
        f += 1
        if n < A + B and f <= B:
            n += 1
            print("Yes")
        else:
            print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
na=0
nb=0
s=input()
for i in range(a):
  if s[i]=='a':
    if na+nb<b+c:
      print('Yes')
      na+=1
    else:
      print('No')
  elif s[i]=='b':
    if na+nb<b+c and nb<c:
      print('Yes')
      nb+=1
    else:
      print('No')
  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] == "c":
    print("No")
  elif s[i] == "b" and b:
    print("Yes")
    b -= 1
  elif s[i] == "a" and a:
    print("Yes")
    a -= 1
  elif s[i] == "a" and b:
    print("Yes")
    b -= 1
  else:
    print("No")

Submission status: Accepted

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

    passed = 0
    passed_b = 0
    for i in range(len(S)):
        if S[i] == 'c':
            print('No')
            continue
        if passed >= A + B:
            print('No')
            continue
        if S[i] == 'b':
            if passed_b < B:
                print('Yes')
                passed += 1
                passed_b += 1
            else:
                print('No')
        else:
            print('Yes')
            passed += 1


if __name__ == '__main__':
    main()

Submission status: Accepted

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

tp=0
up=0

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

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

b_all=a+b
n_all=0
n_int=0
for i in s:
    if i=='a':
        if n_all<b_all:
            n_all+=1
            print("Yes")
        else:
            print("No")
    elif i=='b':
        if n_all<b_all and n_int<b:
            n_all+=1
            n_int+=1
            print("Yes")
        else:
            print("No")
    else:
        print("No")

Submission status: Accepted

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

Submission status: Accepted

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

passed = []
count = 0
for i in range(N):
  if s[i] == "a" and len(passed) < A + B:
    passed.append(s[i])
    print("Yes")
  elif s[i] == "b" and len(passed) < A + B and count < B:
    passed.append(s[i])
    count += 1
    print("Yes")
  else:
    print("No")

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline


def read():
    N, A, B = map(int, input().strip().split())
    S = input().strip()
    return N, A, B, S

def solve(N, A, B, S):
    na = 0
    nb = 0
    for s in S:
        if s == 'a' and na + nb < A + B:
            na += 1
            print('Yes')
        elif s == 'b' and na + nb < A + B and nb < B:
            nb += 1
            print('Yes')
        else:
            print('No')

if __name__ == '__main__':
    inputs = read()
    solve(*inputs)

Submission status: Accepted

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

j=0
f=0

for  s in S:
    yosentoppa = False
    if s == "c":
        pass
    elif j+f < A+B:
        if s == "a":
            j+=1    
            yosentoppa = True
        else:
            if f<B:
                yosentoppa = True
                f+=1
    print (['No','Yes'][yosentoppa])

Submission status: Accepted

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

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

Submission status: Accepted

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

passed = 0;
b_passed = 0;
for i, item in enumerate(list):
    if (item == "a" and passed < a + b):
        print("Yes")
        passed += 1
    elif (item == "b" and passed < a + b and b_passed < b):
        print("Yes")
        passed += 1
        b_passed += 1
    else:
        print("No")

Submission status: Accepted

Solution code:
N, a, b = map(int, input().split())
S = list(input())
ia = 0
ib = 0
for s in S:
    if s == "a" and ia+ib < a+b:
        print("Yes")
        ia += 1
        continue
    if s == "b" and ia+ib < a+b and ib < b:
        print("Yes")
        ib += 1
        continue
    print("No")

Submission status: Accepted

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

SS = ["No"]*len(S)
count = 0
countb = 0

for i in range(len(S)):
  if count == A+B:
      break
  if S[i] == "a":
    SS[i] = "Yes"
    count += 1
  elif S[i] == "b" and countb < B:
    SS[i] = "Yes"
    count +=1
    countb += 1

print('\n'.join(SS))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import defaultdict, deque
import sys
import heapq
import bisect
import itertools
import queue
import copy
import time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7

def inp(): return int(sys.stdin.readline())

def inpl(): return list(map(int, sys.stdin.readline().split()))

def inpl_str(): return list(sys.stdin.readline().split())

n, a, b = inpl()
s = list(input())
ans = []
t = 0
f_s = 0
for v in s:
    if v == 'a':
        if t < (a + b):
            ans.append('Yes')
            t += 1
        else:
            ans.append('No')
    if v == 'b':
        f_s += 1
        if t < (a + b) and f_s <= b:
            ans.append('Yes')
            t += 1
        else:
            ans.append('No')
    if v == 'c':
        ans.append('No')
for i in ans:
    print(i)

Submission status: Accepted

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

    count = 0
    countB = 0
    for c in S:
        if count >= A+B:
            print("No")
        else:
            if c == "a":
                print("Yes")
                count += 1
            elif c == "b":
                if countB >= B:
                    print("No")
                else:
                    print("Yes")
                    count += 1
                    countB += 1
            else:
                print("No")


main()

Submission status: Accepted

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

S = input()
count = 0
c_for = 0
for i in range(N):
    if count < A+B:
        if S[i] == 'a':
            print('Yes')
            count += 1
        elif S[i] == 'b':
            if c_for < B:
                print('Yes')
                count += 1
                c_for += 1
            else:
                print('No')
        else:
            print('No')
    else:
        print('No')

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())
s = input()
ans = []
domestic = 0
or_abroad = 0
for c in s:
    if c == 'a' and domestic + or_abroad < a + b:
        ans.append('Yes')
        domestic += 1
    elif c == 'b' and domestic + or_abroad < a + b and or_abroad < b:
        ans.append('Yes')
        or_abroad += 1
    else:
        ans.append('No')
print('\n'.join(ans))

Submission status: Accepted

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

total = 0
kaigai = 0

for i in range(0, len(L)):
	if L[i] == 'a':
		if total < A + B:
			print('Yes')
			total += 1
		else:
			print('No')
	elif L[i] == 'b':
		if total < A + B and kaigai < B:
			print('Yes')
			total += 1
			kaigai += 1
		else:
			print('No')
	else:
		print('No')

Submission status: Accepted

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

Submission status: Accepted

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

limit = a + b
cnt_b = 0
for v in s:
    if v == "a":
        if limit > 0:
            print("Yes")
            limit -= 1
            continue
        else:
            print("No")
            continue
    elif v == "b":
        cnt_b += 1
        if limit > 0 and cnt_b <= b:
            print("Yes")
            limit -= 1
            continue
        else:
            print("No")
            continue
    else:
        print("No")
        continue

Submission status: Accepted

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

ans_list = []
for i in range(len(s)):
    frag = False
    if s[i] == "a":
        if a > 0:
            a -= 1
            frag = True
        elif b > 0:
            b -= 1
            frag = True
    elif s[i] == "b":
        if b > 0:
            b -= 1
            frag = True
    if frag:
        ans_list.append("Yes")
    else:
        ans_list.append("No")

for i in range(len(s)):
    print(ans_list[i])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys, itertools, fractions, math, collections, heapq
sys.setrecursionlimit(10**7)
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, d=DVSR): return pow(x, d - 2, d)
def DIV(x, y, d=DVSR): return (x * INV(y, d)) % d
def LI(): return [int(x) for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()
def II(): return int(input())

n, a, b = LI()
s = list(input())

aq, bq = 0, 0
for ss in s:
    if ss=='a':
        if aq + bq < a+b:
            print('Yes')
            aq+=1
        else:
            print('No')
    if ss=='b':
        if aq + bq < a+b and bq+1<=b:
            print('Yes')
            bq+=1
        else:
            print('No')
    if ss=='c':
        print('No')

Submission status: Accepted

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

ab = a+b

passed = 0

Bs = 1

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

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
S = input()
#A = list(map(lambda x: int(x)*(-1), input().split()))
#A = [int(input()) for i in range(N)]
#C = [list(map(int, input().split())) for i in range()]

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a 
ab = A+B
b = B
for s in S:
    if s == 'a' and ab > 0:
        print('Yes')
        ab -= 1
    elif s == 'b' and ab > 0 and b > 0:
        print('Yes')
        ab -= 1
        b -= 1
    else:
        print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

n, a, b = na()
s = ns()

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

Submission status: Accepted

Solution code:
N, A, B = input().strip().split()

N, A, B = int(N), int(A), int(B)

S = input().strip()

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

Submission status: Accepted

Solution code:
# from math import factorial,sqrt,ceil
# from itertools import permutations as permus
# from fractions import gcd
# from collections import deque,Counter
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix

# strlist = "abcdefghijklmnopqrstuvwxyz"
N,A,B = map(int,input().split())
S = input()

AplusB = A+B

ans = []
for i in range(len(S)):
    if S[i]=="a" and AplusB>0:
        ans.append("Yes")
        AplusB -= 1
    elif S[i]=="b" and AplusB>0 and B>0:
        ans.append("Yes")
        AplusB -= 1
        B -= 1
    else:
        ans.append("No")

print(*ans,sep="\n")
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

total = 0
kaigai = 0

for i in range (0, len(L)):
	if L[i] == 'a':
		if total < A+B:
			print('Yes')
			total+=1
		else:
			print('No')
	elif L[i] == 'b':
		if total < A+B and kaigai <B:
			print('Yes')
			total+=1
			kaigai+=1
		else:
			print('No')
	else:
		print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)

N, A, B = map(int, readline().split())
S = list(str(input()))

l = 0
l2 = 0
for s in S:
    if s == "a":
        if l < A + B:
            l += 1
            print('Yes')
            continue
    elif s == "b":
        if (l < A + B) and (l2 < B):
            l += 1
            l2 += 1
            print('Yes')
            continue
    print('No')

Submission status: Accepted

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


kaigai = 0
Sankasya = 0

for i in range(1,N+1):
    if S[i-1] == "c":
        print("No")

    if S[i-1] == "a":
        if (Sankasya) < A+B:
            Sankasya = Sankasya + 1
            print("Yes")
        else:
            print("No")
    
    if S[i-1] == "b":
        kaigai = kaigai + 1
        if (Sankasya) < A+B and  B >= kaigai:
            Sankasya = Sankasya + 1
            print("Yes")
        else:
            print("No")

Submission status: Accepted

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

Submission status: Accepted

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

b_cnt = 0
a_cnt = 0
for si in s:
    if si == "c":
        print("No")
        
    elif si == "a":
        if a_cnt+b_cnt < a + b:
            print("Yes")
            a_cnt+=1
        else:
            print("No")
        
    else:
        if a_cnt + b_cnt < a + b and b_cnt < b:
            print("Yes")
            b_cnt += 1
        else:
            print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    N, A, B = [int(v) for v in input().split()]
    S = input()

    c1 = 0
    c2 = 0

    for i in range(N):
        if c1 >= A + B:
            print('No')
            continue

        if S[i] == 'a':
            c1 += 1
            print('Yes')
        elif S[i] == 'b':
            if c2 < B:
                c1 += 1
                print('Yes')
            else:
                print('No')
            c2 += 1
        else:
            print('No')


main()

Submission status: Accepted

Solution code:
n,a,b=map(int,input().split())
s=input()
"""
10 2 3
abccabaabb
->
Yes
Yes
No
No
Yes
Yes
Yes
No
No
No

12 5 2
cabbabaacaba
->
No
Yes
Yes
Yes
Yes
No
Yes
Yes
No
Yes
No
No
"""
n_pass=0
n_fpass=0
ans=[]
for _ in range(n):
    if s[_] == 'a' and n_pass < a+b:
        n_pass+=1
        ans.append('Yes')
    elif s[_] == 'b' and n_pass < a+b and n_fpass < b:
        n_pass+=1
        n_fpass+=1
        ans.append('Yes')
    else:
        ans.append('No')
for _ in range(n):
    print(ans[_])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import collections
import sys
import numpy as np
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
MOD = 10**9+7
import itertools
import math

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

Submission status: Accepted

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

for s in S:
    if s == 'c':
        print('No')
    elif s == 'b':
        if b:
            print('Yes')
            b -= 1
        else:
            print('No')
    else:
        if a:
            print('Yes')
            a -= 1
        elif b:
            print('Yes')
            b -= 1
        else:
            print('No')

Submission status: Accepted

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

sm = 0
foreign = 1

for i in S:
    if i == 'c':
        print('No')
    elif sm < A + B:
        if i == 'b':
            if foreign <= B:
                print('Yes')
                sm += 1
                foreign += 1
            else:
                print('No')
        else:
            print('Yes')
            sm += 1
    else:
        print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,a,b = [int(i) for i in input().split()]

s = input()
ct = 0
bct = 0

for i in s:
    if i == 'a':
        if ct < (a+b):
            print('Yes')
            ct += 1
        else:
            print('No')
    elif i == 'b':
        if ct < (a+b) and bct < b:
            print('Yes')
            ct += 1
            bct += 1
        else:
            print('No')
    else:
        print('No')

Submission status: Accepted

Solution code:
from sys import stdin
input = stdin.readline

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

a = 0
b = 0

for s in S:
    if s == "a":
        if a + b < A + B:
            a += 1
            print("Yes")
        else:
            print("No")
    elif s == "b":
        if a + b < A + 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()
y = 0
k = 0
for i in S:
    if i=='c':
        print('No')
    elif i=='a':
        if (y<(A+B)):
            print('Yes')
            y += 1
        else:
            print('No')
    else:
        if (y<(A+B))and(k<B):
            print('Yes')
            y += 1
            k += 1
        else:
            print('No')

Submission status: Accepted

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

domestic = 0
abroad = 0

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

a_passed = 0
b_passed = 0

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

Submission status: Accepted

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n,a,b = inpl()
s = input()
kaku = 0
kaigai = 0
for i,t in enumerate(s):
    if t == 'a':
        if kaku < a+b:
            res = 'Yes'
            kaku += 1
        else:
            res = 'No'
    elif t == 'b':
        if kaku < a+b and kaigai < b:
            res = 'Yes'
            kaku += 1
            kaigai += 1
        else:
            res = 'No'
    else:
        res = 'No'
    print(res)

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())

AC = 0
BC = 0

for i in S:
    if i == "a":
        if A + B > AC + BC:
            AC += 1
            print("Yes")
        else:
            print("No")
    elif i == "b":
        if A + B > AC + BC and BC < B:
            BC += 1
            print("Yes")
        else:
            print("No")
    else:
        print("No")

Submission status: Accepted

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

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

    if c=='b':
        if a+b>count and (b_count+1)<=b:
            count+=1
            b_count+=1
            print('Yes')
        else:
            b_count+=1
            print('No')

Submission status: Accepted

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

allp = A + B
qual = 0
Brank = 1

for i in range(N):
    if S[i] == 'a' and qual < allp:
        qual += 1
        print('Yes')
    elif S[i] == 'b' and qual < allp and Brank <= B:
        qual += 1
        Brank += 1
        print('Yes')
    else:
        print('No')