Submission #1162887


Source Code Expand

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <cmath>

using namespace std;
 
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)

//最大公約数
long gcd(long a, long b){
	if (a%b==0){
		return b;
	}
	else{
		return gcd(b,a%b);
	}
}

//最小公倍数
long lcm(long a, long b){
	return (a*b) / gcd(a,b);
}

typedef long long ll;

char str[100001];
int r[100001];

int main(){
	int n, a, b;
	
	cin >> n >> a >> b;
	
	scanf("%s", str);
	
	int k = 0, g = 0;
	
	
	REP(i,n){
		if (str[i] == 'a'){
			if (k+g < a+b){
				k++;
				r[i] = 1;
			}
		}
		else if (str[i] == 'b'){
			if (k+g < a+b && g < b){
				g++;
				r[i] = 1;
			}
		}
		
		if (r[i] == 1) cout << "Yes" << endl;
		else cout << "No" << endl;
	}
	
	return 0;
}

Submission Info

Submission Time
Task B - Qualification simulator
User Lemonmaru
Language C++14 (GCC 5.4.1)
Score 200
Code Size 871 Byte
Status AC
Exec Time 160 ms
Memory 1152 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:38:18: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%s", str);
                  ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 13
Set Name Test Cases
Sample s1.txt, s2.txt, s3.txt
All 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, s1.txt, s2.txt, s3.txt
Case Name Status Exec Time Memory
01.txt AC 153 ms 640 KB
02.txt AC 154 ms 1024 KB
03.txt AC 157 ms 1024 KB
04.txt AC 154 ms 1024 KB
05.txt AC 140 ms 640 KB
06.txt AC 152 ms 640 KB
07.txt AC 160 ms 1152 KB
08.txt AC 155 ms 1152 KB
09.txt AC 153 ms 768 KB
10.txt AC 154 ms 896 KB
s1.txt AC 1 ms 256 KB
s2.txt AC 1 ms 256 KB
s3.txt AC 1 ms 256 KB