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:
# -*- coding: utf-8 -*-

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
#from math import gcd
import bisect
from collections import defaultdict
from collections import deque
from collections import Counter
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]

######OUTPUT######
def P(arg): print(arg); return
def Y(): print("Yes"); return
def N(): print("No"); return
def E(): exit()
def PE(arg): print(arg); exit()
def YE(): print("Yes"); exit()
def NE(): print("No"); exit()

#####Shorten#####
def DD(arg): return defaultdict(arg)


#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr

#####MakeDivisors######
def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors

#####MakePrimes######
def make_primes(N):
  max = int(math.sqrt(N))
  seachList = [i for i in range(2,N+1)]
  primeNum = []
  while seachList[0] <= max:
    primeNum.append(seachList[0])
    tmp = seachList[0]
    seachList = [i for i in seachList if i % tmp != 0]
  primeNum.extend(seachList)
  return primeNum

#####GCD#####
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#####BitCount#####
def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count

#####ChangeBase#####
def base_10_to_n(X, n):
  if X//n:
    return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i-1])*n**i for i in range(len(str(X))))

#####IntLog#####
def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count

#############
# Main Code #
#############

N,A,B = IL()
S = S()
countA = 0
countB = 0

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

Submission status: Accepted

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

## Library

import sys
from fractions import gcd
import math
from math import ceil,floor
import collections
from collections import Counter

## input

# n=int(input())
# A,B,C,D=map(int, input().split())
# string = input()
# yoko = list(map(int, input().split()))
# tate = [int(input()) for _ in range(N)]
# N, M = map(int,input().split()) 
#    P = [list(map(int,input().split())) for i in range(M)]

N,A,B=map(int, input().split())
S = input()
tmp1 = 0
tmp2 = 0

for i in range(0,N):
    if tmp1 < A+B:
        if S[i] == "a":
            tmp1 += 1
            print("Yes")
        elif (S[i] == "b") & (tmp2 < B):
            tmp1 += 1
            tmp2 += 1
            print("Yes")
        else:
            print("No")
    else:
        print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

passed_a = 0
passed_b = 0
ans = []
for i in range(N):
    if S[i] == 'a':
        if passed_a + passed_b < A + B:
            ans.append('Yes')
            passed_a += 1
        else:
            ans.append('No')

    if S[i] == 'b':
        if passed_a + passed_b < A + B and passed_b < B:
            ans.append('Yes')
            passed_b += 1
        else:
            ans.append('No')

    if S[i] == 'c':
        ans.append('No')

for _ in ans:
    print(_)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

temp_num_people = 0
temp_overseas = 0
for s,i in zip(S,range(len(S))):
    if s == 'a':
        if temp_num_people < A+B:
            print('Yes')
            temp_num_people+=1
        else:
            print('No')

    if s == 'b':
        if (temp_num_people < A+B) and (temp_overseas < B):
            print('Yes')
            temp_num_people+=1
            temp_overseas+=1
        else:
            print('No')

    if s == 'c':
        print('No')

Submission status: Accepted

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

participants = input()

count = 0
b_count = 1
for participant in participants:

    if participant == "a" and count < a+b:
        print("Yes")
        count += 1
    elif participant == "b" and count < a+b:
        if b_count <= b:
            count += 1
            b_count += 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
A=0
B=0
for i in s:
    if A+B<c:
        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:
# B - Qualification simulator

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

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

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
S = input()
a = 0
b = 0
for char in S:
    if char == 'a' and a+b < A+B:
        print("Yes")
        a += 1
    elif char == '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())
st = input()
c = a + b
for s in st:
    if s == "a":
        if c >= 1:
            c -= 1
            print("Yes")
        else:
            print("No")
    elif s == "b":
        if c >= 1 and b >= 1:
            c -= 1
            b -= 1
            print("Yes")
        else:
            print("No")
    else:
        print("No")

Submission status: Accepted

Solution code:
# coding: utf-8

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

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

Submission status: Accepted

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

import sys

T = A + B
Ta = B

for p in S:
  if p == "c":
    print("No")
    continue
    
  elif p == "a":
    if T > 0:
      print("Yes")
      T -= 1
    else:
      print("No")
      
  else:
    if T > 0 and Ta > 0:
      print("Yes")
      Ta -= 1
      T -= 1
    else:
      print("No")

Submission status: Accepted

Solution code:
#a, b, m = map(int,input().split())
#a = list(map(int,input().split()))
#bc = 

n, a, b = map(int,input().split())
s = list(input())
x = 0 #予選通過人数
y = 0 #海外の人数

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

Submission status: Accepted

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

passer=0
passb=0
for p in S:
    if p =="c":
        print("No")
    if p=="a":
        if passer < A+B:
            print("Yes")
            passer+=1
        else:
            print("No")
    if p=="b":
        if passer <A+B and passb <B:
            print("Yes")
            passer+=1
            passb+=1
        else:
            print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    n, A, B = list(map(int, input().split()))
    S = input()
    a, b = 0, 0
    for s in S:
        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')
        else:
            print('No')

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#入力
n,a,b = map(int, input().split())
s = list(input()) #1文字ずつリストに格納する
#総通過人数
pass_contest = 0
#海外学生の順位
rank_overseas = 0
for i in range(len(s)):
    if s[i] == "c":
        print("No")
    elif s[i] == "a" and pass_contest < a+b:
        print("Yes")
        pass_contest += 1
    elif s[i] == "b":
        rank_overseas += 1
        if pass_contest < a+b and rank_overseas <= b:
            print("Yes")
            pass_contest += 1
        else:
            print("No")
    else:
        print("No")

Submission status: Accepted

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

nowA=0
nowB=0

for s in S:
    if s=='c':
        print('No')
    elif s=='a':
        if nowA+nowB<A+B:
            print('Yes')
            nowA+=1
        else:
            print('No')
    else:
        if nowA+nowB<A+B and nowB<B:
            print('Yes')
            nowB+=1
        else:
            print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,a,b = map(int,input().split())
li = list(input())
c=a+b
for stu in li:
  if stu=='a':
    if c==0:
      print("No")
    else:
      c-=1
      print("Yes")
  elif stu=='b':
    if b==0 or c==0:
      print("No")
    else:
      c-=1
      b-=1
      print("Yes")
  else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(N):
    if S[i] == 'a':
        S[i] = 'Yes'
        cnt += 1
    elif S[i] == 'b':
        if b_cnt >= B:
            continue
        S[i] = 'Yes'
        cnt += 1
        b_cnt += 1

    if cnt == A + B:
        break

ans = ['No' if j != 'Yes' else j for j in S]

for k in range(N):
    print(ans[k])

Submission status: Accepted

Solution code:
def resolve():
    N, A, B = list(map(int, input().split()))
    S = str(input())
    num = 0
    foreignnum = 1
    for i in range(N):
        if S[i] == 'a':
            if (num < A + B):
                num += 1
                print('Yes')
            else:
                print('No')

        if S[i] == 'b':
            if (num < A + B) and (foreignnum <= B):
                num += 1
                foreignnum += 1
                print('Yes')
            else:
                print('No')

        if S[i] == 'c':
            print('No')
    return
resolve()

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())
st = str(input())
bor = a + b

ans = []

pa = 1
fore = 1

for i in st:
    if i == 'a':
        if pa <= bor:
            print('Yes')
            pa += 1
        else:
            print('No')
    elif i == 'b':
        if pa <= bor:
            if fore <= b:
                print('Yes')
                pa += 1
                fore +=1
            else:
                print('No')
        else:
            print('No')
    else:
        print('No')

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

answer = 0
b_list = 0
for idx, moji in enumerate(S):
    if moji == "a" and answer < A + B:
        answer += 1
        print("Yes")
        continue
    elif moji == "b":
        b_list += 1
        if answer < A + B and b_list <= B:
            answer += 1
            print("Yes")
            continue
    print("No")

Submission status: Accepted

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

t_pass = 0
f_pass = 1

for e in S:
    if e == 'a':
        if t_pass < a + b:
            t_pass += 1
            print('Yes')
        else:
            print('No')
    elif e == 'b':
        if t_pass < a + b and f_pass <= b:
            t_pass += 1
            f_pass += 1
            print('Yes')
        else:
            print('No')
    else:
        print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())
S = input()
cnt = 0
cnt2 = 0
for s in S:
    if 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 = input()

for c in S:
    if c == 'b':

        B -= 1
        if B >= 0 and (A+B) >= 0:
            print("Yes")
        else:
            print("No")
    elif c == 'a':
        A -= 1
        if (A+max(0, B)) >= 0:
            print("Yes")
        else:
            print("No")
    else:
        print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, A, B = [int(x) for x in input().split(" ")]
s = input()
num_passed = 0
num_passed_f = 0
for index, s in enumerate(s):
    if s == "a":
        if num_passed < A + B:
            print("Yes")
            num_passed += 1
            continue
    if s == "b":
        if num_passed < A + B and num_passed_f < B:
            print("Yes")
            num_passed += 1
            num_passed_f += 1
            continue
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(n):
    if s[i] == "a":
        if  a_Yes + b_Yes <a+b:
            print("Yes")
            a_Yes += 1
        else:
            print("No")

    elif s[i] == "b" :
        if b_Yes < b and  a_Yes + b_Yes <a+b:
            print("Yes")
            b_Yes += 1
        else:
            print("No")

    else:
        print("No")

Submission status: Accepted

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

Submission status: Accepted

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

all = list(s)
count = 0
count_b = 0
for i in all:
    if i == 'a':
        if count < a + b:
            print('Yes')
            count += 1
        else:
            print('No')
    elif i == 'b':
        if (count < a + b) and (count_b < b):
            print('Yes')
            count += 1
            count_b += 1
        else:
            print('No')
    else:
        print('No')

Submission status: Accepted

Solution code:
from sys import stdin
N, A, B = [int(_) for _ in stdin.readline().rstrip().split()]
S = stdin.readline().rstrip()
limit = A + B
ab_count, b_count = 0, 0
for c in S:
    if c == 'a':
        if ab_count < limit:
            print('Yes')
            ab_count += 1
        else:
            print('No')
    elif c == 'b':
        if ab_count < limit and b_count < B:
            print('Yes')
            ab_count += 1
            b_count += 1
        else:
            print('No')
    else:
        print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, A, B = input().split(' ')
N = int(N)
A = int(A)
B = int(B)
S = []
S = list(input())
JS = 0
AS = 0
OT = 0

for i in range(N):
  if S[i] == 'a' and A+B > JS+AS:
    print('Yes')
    JS += 1
  elif S[i] == 'b' and A+B > JS+AS and AS < B:
    print('Yes')
    AS += 1
  else:
    print('No')

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())
s = input()
s = [str(c) for c in s]
pas = 0
f = 0

for i, v in enumerate(s):
    if pas < a + b and v == "a":
        pas += 1
        print("Yes")
    elif pas < a + b and f < b and v == "b":
        pas += 1
        f += 1
        print("Yes")
    else:
        print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

cnt1 = 0
cnt2 = 0

for i in range(len(X)):
	if X[i] == "c":
		print("No")

	elif X[i] == "a":
		if cnt1 < S:
			print("Yes")
			cnt1 += 1
		else: print("No")
	else:
		if cnt1 < S and cnt2 < B:
			print("Yes")
			cnt1 += 1
			cnt2 += 1
		else: print("No")

Submission status: Accepted

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

for i in range(len(S)):
    if S[i] == "c":
        print("No")
    if S[i] == "a":
        if A > 0:
            print("Yes")
            A = A-1
        elif B > 0:
            print("Yes")
            B = B-1
        else :
            print("No")
    if S[i] == "b":
        if B > 0:
            print("Yes")
            B = B-1
        else :
            print("No")

Submission status: Accepted

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

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

Submission status: Accepted

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

su = A+B
a = 0
b = 0


for i in range(N):
    f = 0
    if S[i] == "a":
        if su > a + b:
            f = 1
            a += 1
    elif S[i] == "b":
        if su > a+b and B > b:
            f = 1
            b += 1
    if f:
        print("Yes")
    else:
        print("No")

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())
s = input()
q = [1] * n
for i,l in enumerate(s):
    q[i] *= ((l == "b" and b > 0) or l == "a") and a + b > 0
    b -= q[i]*(l == "b")
    a -= q[i]*(l == "a")
print("\n".join(["YNeos"[1-i::2] for i in q]))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

# In[16]:


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


# In[17]:


ab = A+B
ab_count = 0
b_count = 0
for s in list(S):
#     print(s)
    if s == "a":
        if ab_count < ab:
            print("Yes")
            ab_count += 1
        else:
            print("No")
    elif s == "b":
        if ab_count < ab and b_count < B:
            print("Yes")
            ab_count += 1
            b_count += 1
        else:
            print("No")
    else:
        print("No")


# In[ ]:

Submission status: Accepted

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

cnt = 0 # 予選通過人数
rank_f = 1 # 海外学生の順位
for i in range(N):
  if(S[i] == 'a'):
    if(cnt < A+B):
      print('Yes')
      cnt += 1
    else:
      print('No')
  elif(S[i] == 'b'):
    if((cnt < A+B)and(rank_f <= B)):
      print('Yes')
      rank_f += 1
      cnt += 1
    else:
      print('No')
  elif(S[i] == 'c'):
     print('No')