| 比赛 | 
    名字我取了 | 
    评测结果 | 
    AAAAAAAAAA | 
    | 题目名称 | 
    餐馆的桌子 | 
    最终得分 | 
    100 | 
    | 用户昵称 | 
    Hzoi_Maple | 
    运行时间 | 
    0.016 s  | 
    | 代码语言 | 
    C++ | 
    内存使用 | 
    0.31 MiB  | 
    | 提交时间 | 
    2017-09-15 21:37:54 | 
显示代码纯文本
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int n,a,b;
int read(){
	int sum=0;char ch=getchar();
	while(ch<'0'||ch>'9') ch=getchar();
	while(ch>='0'&&ch<='9'){sum=sum*10+ch-'0';ch=getchar();}
	return sum;
}
int num,ans,x;
int main(){
	freopen("RT.in","r",stdin);
	freopen("RT.out","w",stdout);
	n=read();a=read();b=read();
	for(int i=1;i<=n;++i){
		x=read();
		if(x==1){
			if(a) a--;
			else{
				if(b) b--,num++;
				else if(num) num--;
				else ans++;
			}
		}
		else{
			if(b) b--;
			else ans+=2;
		}
	}
	printf("%d\n",ans);
	return 0;
}