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:
import sys
import heapq
import re
from itertools import permutations
from bisect import bisect_left, bisect_right
from collections import Counter, deque
from fractions import gcd
from math import factorial, sqrt
from functools import lru_cache, reduce
INF = 1 << 60
mod = 1000000007
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

# UnionFind
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

# ダイクストラ
def dijkstra_heap(s, edge, n):
    #始点sから各頂点への最短距離
    d = [10**20] * n
    used = [True] * n #True:未確定
    d[s] = 0
    used[s] = False
    edgelist = []
    for a,b in edge[s]:
        heapq.heappush(edgelist,a*(10**6)+b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        #まだ使われてない頂点の中から最小の距離のものを探す
        if not used[minedge%(10**6)]:
            continue
        v = minedge%(10**6)
        d[v] = minedge//(10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
    return d

# 素因数分解
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

# 2数の最小公倍数
def lcm(x, y):
    return (x * y) // gcd(x, y)

# リストの要素の最小公倍数
def lcm_list(numbers):
    return reduce(lcm, numbers, 1)

# リストの要素の最大公約数
def gcd_list(numbers):
    return reduce(gcd, numbers)

# ここから書き始める
n, a, b = map(int, input().split())
s = input()
total_cnt = 0
b_cnt = 0
for i in s:
    if i == "a":
        if total_cnt < a + b:
            print("Yes")
            total_cnt += 1
        else:
            print("No")
    elif i == "b":
        if total_cnt < a + b and b_cnt + 1 <= b:
            print("Yes")
            total_cnt += 1
            b_cnt += 1
        else:
            print("No")
    elif i == "c":
        print("No")

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
printV = lambda x: print(*x, sep="\n")
printH = lambda x: print(" ".join(map(str,x)))
def IS(): return sys.stdin.readline()[:-1]
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LII(rows_number): return [II() for _ in range(rows_number)]
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]

def main():
	n,a,b = MI()
	S = IS()
	cnt = 0
	frank = 1
	for i,s in enumerate(S):
		if s == 'a':
			if cnt < a+b:
				cnt += 1
				print("Yes")
			else:
				print("No")
		elif s == 'b':
			if cnt < a+b and frank <= b:
				cnt += 1
				frank += 1
				print("Yes")
			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())
yosen = 0
yosen_kaigai = 0
for i in range(N):
    if S[i] == 'a':
        if yosen < A + B:
            yosen += 1
            print('Yes')
        else:
            print('No')
    elif S[i] == 'b':
        if yosen < A + B and yosen_kaigai < B:
            yosen += 1
            yosen_kaigai += 1
            print('Yes')
        else:
            print('No')
    else:
        print('No')

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split(' '))
S = input()
acc = 0
acc_b = 0
ans = ''
i = 0
for s0 in S:
    if acc >= (a+b) or s0 == 'c':
        ans += 'No\n'
    elif s0 == 'a':
        ans += 'Yes\n'
        acc += 1
    elif acc_b < b:
        ans += 'Yes\n'
        acc += 1
        acc_b += 1
    else:
        ans += 'No\n'
print(ans)

Submission status: Accepted

Solution code:
import sys
input=sys.stdin.readline
n,a,b=map(int,input().split())
s=input()
nin=0
fr=0;l=[""]*n
for i in range(n):
    l[i]="No"
    if s[i]=="a" and nin<a+b:nin+=1;l[i]="Yes"
    elif s[i]=="b":
        if fr+1<=b and nin<a+b:nin+=1;fr+=1;l[i]="Yes"
    
print(*l,sep="\n")

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
S = input()
a = 0
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()

n_p = n_f = 0

for s in S:
  if s == "a" and n_p < A + B:
    n_p += 1
    print("Yes")
    continue

  if s == "b" and n_p < A + B and n_f < B:
    n_p += 1
    n_f += 1
    print("Yes")
    continue

  print("No")

Submission status: Accepted

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

Submission status: Accepted

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

nd = ni = 0
for s in S:
    if s == 'a':
        if nd + ni < A + B:
            nd += 1
            ans = True
        else:
            ans = False
    elif s == 'b':
        if nd + ni < A + B and ni < B:
            ni += 1
            ans = True
        else:
            ans = False
    else:
        ans = False
    print('Yes' if ans else 'No')

Submission status: Accepted

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

num_pass = 0
num_pass_kaigai = 0

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

Submission status: Accepted

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

Submission status: Accepted

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

total_AB, total_B = 0, 0
for c in S:
    if c=='a':
        if total_AB < A+B:
            print('Yes')
            total_AB += 1
        else:
            print('No')
    elif c=='b':
        if total_AB < A+B and total_B < B:
            print('Yes')
            total_AB += 1
            total_B += 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 ch in S:
    if ch == 'a':
        if nA + nB < A + B:
            print("Yes")
            nA += 1
        else:
            print("No")
    elif ch == 'b':
        if nA + nB < A + B and nB < B:
            nB += 1
            print("Yes")
        else:
            print("No")
    else:
        print("No")

Submission status: Accepted

Solution code:
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n,a,b = iim()
cap = a+b
cA = 0
cB = 0

s = input()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10

#solve
def solve():
    b = 0
    N, A, B =LI()
    s = S()
    PASS = 0
    for i in range(N):
        if s[i] == "c":
            print("No")
            continue
        if PASS < A + B:
            if s[i] == "a":
                PASS += 1
                print("Yes")
            else:
                if b < B:
                    PASS += 1
                    b += 1
                    print("Yes")
                else:
                    print("No")
        else:
            print("No")

    return


#main
if __name__ == '__main__':
    solve()

Submission status: Accepted

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

Submission status: Accepted

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

win = 0
inter = 1
ans = []
for i in range(len(S)):
    if S[i] == "a":
        if win < A + B:
            ans.append("Yes")
            win += 1
        else:
            ans.append("No")
    elif S[i] == "b":
        if win < A + B and inter <= B:
            ans.append("Yes")
            win += 1
        else:
            ans.append("No")
        inter += 1
    else:
        ans.append("No")

for a in ans:
    print(a)

Submission status: Accepted

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

Submission status: Accepted

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

S = list(input())

t = 0
s = 0

for i in S:
    if i == 'c':
        print("No")
    elif i == 'a' and t < a + b:
        print("Yes")
        t += 1
    elif i == 'b' and t < a + b and s < b:
        print("Yes")
        t += 1
        s += 1
    else:
        print("No")

Submission status: Accepted

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

num_japan_student = 0
num_foreign_student = 0
ans_list = ["No"] * N
for i in range(N):
    if S[i] == 'a':
        num_japan_student += 1
        if num_japan_student + num_foreign_student <= A + B:
            ans_list[i] = "Yes"
    elif S[i] == 'b':
        num_foreign_student += 1
        if num_foreign_student <= B and num_japan_student + num_foreign_student <= A + B:
            ans_list[i] = "Yes"
        else:       # 海外学生が進めなかったら足したnum_foreignは減らす
            num_foreign_student -= 1
    else:
        pass

for i in range(N):
    print(ans_list[i])

Submission status: Accepted

Solution code:
n, a, b = input().split()
s = input()
n = int(n)
a = int(a)
b = int(b)
passed = 0
ovrank = 0
def isPassed(i, a, b, passed, rank=-1):
    if (i == 0):
        if (a + b > passed):
            return "Yes"
        else:
            return "No"
    else:
        if (a + b > passed and rank<=b):
            return "Yes"
        else:
            return "No"

for i in range(len(s)):
    if (s[i] == "a"):
        tmp = isPassed(0, a, b, passed)
        if (tmp == "Yes"):
            passed += 1
        print(tmp)
    elif (s[i] == "b"):
        ovrank+=1
        tmp = (isPassed(1, a, b, passed, ovrank))
        if (tmp == "Yes"):
            passed += 1
        print(tmp)
    else:
        print("No")

Submission status: Accepted

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

Submission status: Accepted

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

for e in s:
    ans = "No"

    if e == "a":
        if a + b > 0:
            ans = "Yes"
            a -= 1

    elif e == "b":
        if a + b > 0 and b > 0:
            ans = "Yes"
            b -= 1

    print(ans)

Submission status: Accepted

Solution code:
n,a,b = map(int,input().split())
s = list(input())
A = 0 #国内の合格者
B = 0 #海外の合格者

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

Submission status: Accepted

Solution code:
def main():
    n, a, b = map(int, input().split())
    s = input().rstrip()
    ans = [None]*n
    cnt_a, cnt_b = 0, 0
    for i in range(n):
        if s[i] == "a":
            if cnt_a + cnt_b < a + b:
                ans[i] = "Yes"
                cnt_a += 1
            else:
                ans[i] = "No"
        elif s[i] == "b":
            if cnt_a + cnt_b < a + b and cnt_b < b:
                ans[i] = "Yes"
                cnt_b += 1
            else:
                ans[i] = "No"
        else:
            ans[i] = "No"
    for q in ans:
        print(q)

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#定義
count = 0 #

##ロジック
N,A,B = map(int, input().split()) # N=参加人数、A=国内予選通過人数、B=海外予選通過人数
                                  # ただし、国内組は海外予選通過人数に余りがあるなら通過
S = input()                       # S=参加者の情報
for i in S:
  if i == "a":
    if A != 0:
      print("Yes")
      A = A - 1
    elif B != 0:
      print("Yes")
      B = B -1
    else:
      print("No")
  elif i == "b":
    if B != 0:
      print("Yes")
      B = B - 1
    else:
      print("No")
  
  else:
    print("No")

Submission status: Accepted

Solution code:
N,A,B = map(int,input().split())
S = list(input())
cnt = [0,0]
ans = [False]*N
for i in range(N):
    if (S[i] == "c"):
        continue

    if (S[i] == "a"):
        if (sum(cnt) < A+B):
            cnt[0] += 1
            ans[i] = True
    
    if (S[i] == "b"):
        if (sum(cnt) < A+B):
            if (cnt[1] < B):
                cnt[1] += 1
                ans[i] = True

for i in range(N):
    if (ans[i]):
        print("Yes")
    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()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

yosen_ok=0
kaigai=0
for i,ss in enumerate(s):
    if yosen_ok<a+b:
        if ss=='a':
            yosen_ok+=1
            print('Yes')
        elif ss=='b':
            kaigai+=1
            if kaigai<=b:
                yosen_ok+=1
                print('Yes')
            else:
                print('No')
        else:
            print('No')
        continue
    else:
        print('No')

Submission status: Accepted

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

for i in input():
        if i=="a":
                if allr<=a+b:
                        print("Yes")
                        allr += 1
                else: print("No")
        elif i=="b":
                if allr<=a+b and abrr<=b:
                        print("Yes")
                        allr += 1
                else: print("No")
                abrr += 1
        else: print("No")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
n,a,b = map(int,input().split()) 
s = list(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# - Qualification simulator
N, A,B = map(int, input().split())
S = input()
tmp = 0
tmp2 = 0

for i in range(N):
    if S[i] =="a":
        tmp += 1
    elif S[i] =="b":
        tmp2 += 1
    else:
        pass

    if S[i] =="a" and tmp <= A+B:
        print("Yes")
    elif S[i] =="b" and tmp+1 <= A+B and tmp2 <= B:
        tmp += 1
        print("Yes")
    else:
        print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,a,b = map(int,input().split())
s = str(input())
lists_s = list(enumerate(s))
ans = []
cnt = 0
b_rank = 0
for i,c in lists_s:
    if c == "a":
        if cnt >= (a+b):
            ans.append("No")
        elif cnt < (a+b):
            ans.append("Yes")
            cnt += 1
    elif c == "b":
        b_rank += 1
        if cnt < (a+b) and b_rank <= b:
            ans.append("Yes")
            cnt += 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 = input()

ans = []
inout = out = 0
for c in S:
    if c=='a':
        if inout < A+B:
            inout += 1
            ans.append('Yes')
        else:
            ans.append('No')
    elif c=='b':
        if inout < A+B and out < B:
            inout += 1
            out += 1
            ans.append('Yes')
        else:
            ans.append('No')
    else:
        ans.append('No')
print(*ans, sep='\n')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
n,a,b = map(int,input().split())
s = input()
cnt = 0
cnt_foreign = 0
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 cnt_foreign < b:
            print("Yes")
            cnt += 1
            cnt_foreign += 1
        else: print("No")
    else: print("No")

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

total = 0
tot_b = 0

ans = []

for s in S:
    if s == "a" and total < A + B:
        ans.append("Yes")
        total += 1
    elif s == "b" and total < A + B and tot_b < B:
        ans.append("Yes")
        tot_b += 1
        total += 1
    else:
        ans.append("No")

print(*ans, sep="\n")

Submission status: Accepted

Solution code:
def main():
    N, A, B = (int(i) for i in input().split())
    S = input()
    cnt = 0
    cnt_ob = 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 cnt_ob < B:
                print("Yes")
                cnt += 1
                cnt_ob += 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()

a = b = 0

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

Submission status: Accepted

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

total = 0
overseas = 0

for si in S:
    if si == 'c':
        print('No')
    elif si == 'a':
        if total < A + B:
            total += 1
            print('Yes')
        else:
            print('No')
    else:
        if total < A + B and overseas + 1 <= B:
            total += 1
            overseas += 1
            print('Yes')
        else:
            print('No')

Submission status: Accepted

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

an = 0  # 今までaが何人いたか
bn = 0  # 今までbが何人いたか
bn2 = 0

total = 0
overseas = 0

for si in S:
    if si == 'c':
        print('No')
    elif si == 'a':
        if total < A + B:
            total += 1
            print('Yes')
        else:
            print('No')
    else:
        if total < A + B and overseas + 1 <= B:
            total += 1
            overseas += 1
            print('Yes')
        else:
            print('No')

Submission status: Accepted

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

an = 0  # 今までaが何人いたか
bn = 0  # 今までbが何人いたか
an2 = 0 # 今ままでaの合格者が〜
bn2 = 0

for si in S:
    if si == 'c':
        print('No')
    elif si == 'a':
        if an2 + bn2 < A + B:
            print('Yes')
            an2 += 1
        else:
            print('No')
        an += 1
    else:
        if an2 + bn2 < A + B and bn + 1 <= B:
            print('Yes')
            bn2 += 1
        else:
            print('No')
        bn += 1