| 比赛 | 
    名字我取了 | 
    评测结果 | 
    AAAWAAAAAA | 
    | 题目名称 | 
    餐馆的桌子 | 
    最终得分 | 
    90 | 
    | 用户昵称 | 
    CSU_Turkey | 
    运行时间 | 
    0.049 s  | 
    | 代码语言 | 
    C++ | 
    内存使用 | 
    1.07 MiB  | 
    | 提交时间 | 
    2017-09-15 21:43:00 | 
显示代码纯文本
#include<bits/stdc++.h>
using namespace std;
int n,a,b,t[200005],ans;
int main()
{
	freopen("RT.in","r",stdin);
	freopen("RT.out","w",stdout);
//	freopen("1.txt","r",stdin);
	scanf("%d%d%d",&n,&a,&b);
	int h=a+b*2;
	for(int i=1;i<=n;i++)scanf("%d",&t[i]),ans+=t[i];
	sort(t+1,t+n+1);
	for(int i=n;i>=1;i--){
		if(t[i]==2){
			if(b)b--;
		}
		else{
			if(b)b--,a+=2;
			if(a)a--;
		}
	}
	cout<<ans-(h-a-b*2);
	return 0;
}