ZOJ 3757 Alice and Bod 模拟

上次的ZJU月赛题,规则比较复杂,当时就连题意都没摸清楚,只觉得非常复杂

比完后敲啊敲啊敲,连续WA啊,该反思下自己,没按照题意来设置条件,题目中说了 白球入袋并且。。。 给对手加分 ,白球未入袋并且。。。给对手加分,这个白球未入袋的情况也要加在判断条件里啊啊啊啊,还有就是有个地方要排序我居然忘了,好久都没发现。

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int n,m;
int a[];
int vis[];
int ans[];
int hit[],c[];
int main()
{
while (scanf("%d%d",&n,&m)!=EOF)
{
for (int i=;i<n;i++)
scanf("%d",&a[i]);
sort(a,a+n);
memset(vis,,sizeof vis);
int target=,turn=;
ans[]=ans[]=;
int stock,in;
for (int i=;i<m;i++)
{
scanf("%d",&stock);
bool ishit=;
for (int i=;i<stock;i++)
{
scanf("%d",&hit[i]);
if (hit[i]==a[target]) ishit=;
}
sort(hit,hit+stock);
scanf("%d",&in);
bool flag=false;
int sum=;
for (int i=;i<in;i++)
{
scanf("%d",&c[i]);
if (c[i]==a[target]) flag=true;
sum+=c[i];
vis[c[i]]=;
}
sort(c,c+in);
if (stock==)
{
ans[-turn]+=a[target];
}
else
if (in!= && c[]==){
ans[-turn]+=hit[stock-];
}
else
if (stock> || (stock== && hit[]!=a[target])){
ans[-turn]+=hit[stock-];
}
else
if (in> && flag )
{
ans[turn]+=sum;
//turn=1-turn;
//target++;
while (vis[a[target]]) target++;
continue;
}
if (in>)
{
ans[-turn]+=sum;
}
turn=-turn;
while (vis[a[target]]) target++;
}
printf("%d : %d\n",ans[],ans[]);
}
return ;
}
上一篇:zoj 3757 Alice and Bob and Cue Sports 模拟


下一篇:ZOJ 3529 A Game Between Alice and Bob(博弈论-sg函数)