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: Runtime Error

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

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

Submission status: Runtime Error

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

a_counter, b_counter = 0

while S != "":
  s = S[0]
  if s == "a" and a_counter + b_counter <=a+b:
    a_counter += 1
    print("Yes")
  elif s == "b" and b_counter <= b and a_counter + b_counter <=a+b:
    b_counter += 1
    print("Yes")
  else:
    print("No")
  
  S = S[1:]

Submission status: Runtime Error

Solution code:
n,in,out=map(int,input().split())
b=input()
kokunai=0
kaigai=0
for i in range(n):
  if(b[i]=='c'):
    print('No')
  else if(b[i]=='a'):
    if(kokunai+kaigai>=in+out):
      print('No')
    else:
      kokunai=kokunai+1
      print('Yes')
  else:
    if(kokunai+kaigai>=in+put or kaigai>=out):
      print('No')
    else:
      print('Yes')

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N, A, B = map(int, input().split())
C = input()
D = [C[i:i+1] for i in range(N)]
AA = 0
BB = 0
for i in(D):
  if D[i] == 'c':
    print('No')
  elif D[i] =='a' and A+B > AA+BB:
    print('Yes')
    AA += 1
  elif D[i] =='a' and A+B > AA+BB and BB < B:
    print('Yes')
    BB += 1
  else:
    print('No')

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N,A,B=map(int,input().split())
S=list(map(input().split()))
sin=0
cos=0
K=list.count("a")
G=list.count("b")
for i in range(S)
	if S.pop(i)='a'or'b':
    sin+=1
    if S.pop(i)='b':
    cos+=1
    print("Yes" if S.pop(i)='a' and sin<K+G:
"Yes" elif s.pop(i)='b' and G<=cos and sin<K+G:
    else "No")

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
x = list(map(int, input().split()))
s = list(input())
y = len(s)
rank = 0
frank = 0

for i in  s:
    if i == "a":
        if rank <= x[1] + x[2]:
            rank += 1 
            print("Yes")
            
    else:
        print("No")
        
        
    elif i == "b":
        if rank <= x[1] + x[2]:
            rank += 1
            if frank <= x[2]:
                frank += 1
                print("Yes")
            
            else:
                print("No")
            
        else:
            print("No")
            
    else:
        print("No")

Submission status: Runtime Error

Solution code:
x = list(map(int, input().split()))
s = list(input())
y = len(s)
rank = 0
frank = 0

for i in  s:
    if i == "a":
         if rank <= x[1] + x[2]:
                rank += 1 
                print("Yes")
            
        else:
                print("No")
        
        
    elif i == "b":
        if rank <= x[1] + x[2]:
            rank += 1
            if frank <= x[2]:
                frank += 1
                print("Yes")
            
            else:
                print("No")
            
        else:
            print("No")
            
    else:
            print("No")

Submission status: Runtime Error

Solution code:
x = list(map(int, input().split()))
s = list(input())
y = len(s)
rank = 0
frank = 0
 
for i in  s:
    if i == "c":
        print("NO")
        
    elif i == "b":
        if rank =< x[1] + x[2] and frank =< x[2]:
            rank += 1
            frank += 1
            print("YES")
            
        else:
            print("NO")
            
    else:
            if rank =< x[1] + x[2]:
                rank += 1 
                print("YES")
            
            else:
                print("NO")

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;
#define SORT(a) sort((a).begin(), (a).end())
#define RSORT(a) reverse((a).begin(), (a).end())
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
const long long INF = 1LL << 60;
// const int INF=1010101010;
using Graph = vector<vector<int>>;

int main() {
  int n, a, b;
  string s;
  cin >> n >> a >> b >> s;
  int cnt = 0;  //予選通過確定者の人数
  int kaigai = 0;
  rep(i, n) {
    if (cnt + 1 <= a + b) {
      if (s[i] == 'a') {
        cnt++;
        cout << "Yes" << endl;
      } else if (s[i] == 'b') {
        kaigai++;
        if (kaigai <= b) {
          cout << "Yes" << endl;
          cnt++;
        } else
          cout << "No" << endl;
      } else {
        cout << "No" << endl;
      }
    } else
      cout << "No" << endl;
  }
}

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
# coding: utf-8
 
As = list(input().rstrip().split(" "))
N = int(As[0])
A = int(As[1])
B = int(As[2])
 S  = input()
cnt = 1
 
for i in range(N):
    if S[i] == "c":
        print("No")
 
    elif S[i] == "a":
        if cnt < A+B:
            print("Yes")
            cnt +=1
        else:
            print("No")
 
    elif S[i] == "b":
        if cnt < B:
            print("Yes")
            cnt +=1
        else:
            print("No")

Submission status: Runtime Error

Solution code:
# coding: utf-8
 
N,A,B=list(map(int,input().split()))
 S  = input()
cnt = 1
 
for i in range(N):
    if S[i] == "c":
        print("No")
 
    elif S[i] == "a":
        if cnt < A+B:
            print("Yes")
            cnt +=1
        else:
            print("No")

    elif S[i] == "b":
        if cnt < B:
            print("Yes")
            cnt +=1
        else:
            print("No")

Submission status: Runtime Error

Solution code:
or i in range(N) :
    if (S[i] == 'a') and (c < A + B) :
        print('Yes')
        c += 1
    elif S[i] == 'b' and (c < A + B) and b < B:
        print('Yes')
        b += 1
        c += 1
    else :
        print('No')

Submission status: Runtime Error

Solution code:
# coding: utf-8
 
As = list(input().rstrip().split(" "))
N = As[0]
A = As[1]
B = As[2]
 
S  = input()
 
for i in range(N):
    if S[i] == "c":
        print("No")
    elif S[i] == "a":
        if i < A+B:
            print("Yes")
        else:
            print("No")
    elif S[i] == "b":
        if i < B:
            print("Yes")
        else:
            print("No")

Submission status: Runtime Error

Solution code:
# coding: utf-8
 
pre_list = list(input().rstrip().split(" "))
N = pre_list[0]
A = pre_list[1]
N = pre_list[2]
 
S  = input()
 
for i in range(N):
    if S[i] == "c":
        print("No")
    elif S[i] == "a":
        if i < A+B:
            print("Yes")
        else:
            print("No")
    elif S[i] == "b":
        if i < B:
            print("Yes")
        else:
            print("No")

Submission status: Runtime Error

Solution code:
# coding: utf-8
 
pre_list = list(input().rstrip().split(""))
N = pre_list[0]
A = pre_list[1]
N = pre_list[2]

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

Submission status: Runtime Error

Solution code:
# coding: utf-8
 
N,A,B=list(map(int,input().split()))
 S  = input()

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

qualified = 0
qualified_foreign = 0.
for s in S:
    if s == 'c':
        print('No')
    elif s == 'a':
        if qualified < A + B:
            print('Yes')
            qualified += 1
        else:
            print('No')
    else:
        if (qualified < A + B) & (qualified_foreign < B):
            print('Yes')
            qualified += 1
            qualified_foreign += 1
        else:
            print('No')

Submission status: Runtime Error

Solution code:
n,a,b=map(int,input().split())
cab,cb=0,0
for i in range(n):
  s=input()
  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: Runtime Error

Solution code:
n,a,b=map(int,input().split())
bs=1
a=[""]*n
s=input()
for k in range(n):
  if s[k]!="c":
    k<=a+b-1
    if s[k]=="a":
      a[k]="Yes"
    else:
      if bs<=b:
        bs+=1
        a[k]="Yes"
      else:
        a[k]="No"
  else:
    a[k]="No"
print(*a)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
I = lambda: [int(i) for i in input().split()]
n,k=I()
a=I()[::-1]
a.append(0)
b=[]

p=1

for i in range(n):
  if i==0:
    b+=[a[i] + a[i] * (p + 1)**2 + k ]
  elif a[i] * 2 ** 2 + a[i] * (p + 1)**2 + a[i] + k > a[i] * (p + 1 + 1)**2 : 
    b+=[p*a[i] * (p + 1 + 1)**2 - p * a[i] * (p + 1)**2]
    p+=1
  else:
    b+=[a[i] * 2 **2 + a[i] + k]
    p=1
  
print(sum(b) +k*n)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
init_input=map(int, raw_input().split())

mem=raw_input()
mem_list=list(mem)

man=init_input[0]
jap=init_input[1]
ove=init_input[2]

jas=0
ovs=0

for i in range(man):
  if mem==a and jas+ovs<jap+ove:
    jap+=1
    print "Yes"
  elif mem==b and jas+ovs<jap+ove and ovs<ove:
    ovs+=1
    print "Yes"
  else:
    print "No"

Submission status: Runtime Error

Solution code:
args = list(map(lambda x: int(x), raw_input().split()))
N = args[0]
A = args[1]
B = args[2]
s = input()

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

Submission status: Runtime Error

Solution code:
args = list(map(lambda x: int￼(x), input().split()))
N = args[0]
A = args[1]
B = args[2]
s = input()

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

Submission status: Runtime Error

Solution code:
args = list(map(lambda x: int(x)￼, input().split()))
N = args[0]
A = args[1]
B = args[2]
s = input()

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

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
input_line_1 = raw_input()
fields = input_line_1.split()
N = fields[0]
A = fields[1]
B = fields[2]
T = A + B
all = raw_input()
for every in all:
	if every == 'c':
		print 'No'
	elif every == 'a':
		if T > 0:
			T = T - 1
			print 'Yes'
		else:
			print 'No'
	else:
		if T > 0 and B > 0:
			T = T - 1
			B = B - 1
			print 'Yes'
		else:
			print 'No'

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
input_line_1 = raw_input()
fields = input_line_1.split()
N = fields[0]
A = fields[1]
B = fields[2]
T = A + B
all = raw_input()
for every in all:
	if every == 'c':
		print 'No'
	else if every == 'a':
		if T > 0:
			T = T - 1
			print 'Yes'
		else:
			print 'No'
	else:
		if T > 0 and B > 0:
			T = T - 1
			B = B - 1
			print 'Yes'
		else:
			print 'No'

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
# !/usr/bin/env python
# vim: set fileencoding=utf-8 :

"""
#
# Author:   Noname
# URL:      https://github.com/pettan0818
# License:  MIT License
# Created:  2016-10-10
#

# Usage
#
"""

def read_value():
    first_line = input()
    status = first_line.split(" ")

    num_of_contestant = status[0]
    basis = status[1]
    oversea_limit = status[2]

    second_line = input()
    rank_str = second_line

    return [num_of_contestant, basis, oversea_limit, rank_str]


def check_japan(rank, basis, oversea_limit):
    if rank < basis + oversea_limit:
        return "Yes"
    else:
        return "No"

def check_overseas(rank, oversea_rank, basis, oversea_limit):
    if rank < basis + oversea_limit and oversea_rank < oversea_limit:
        return "Yes"
    else:
        return "No"


if __name__ == "__main__":
    input_items = read_value()

    basis = input_items[1]
    oversea_limit = input_items[2]
    rank_str = input_items[3]

    oversea_rank = 0

    for rank, type in enumerate(rank_str):
        if type == "a":
            print(check_japan(rank, basis, oversea_limit))

        if type == "b":
            oversea_rankt += 1
            print(check_overseas(rank, oversea_rank, basis, oversea_limit))

        if type == "c":
            print("No")