上次的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 Bod 模拟的更多相关文章

  1. ZOJ 3757 Alice and Bob and Cue Sports(模拟)

    题目链接 题意 : 玩台球.Alice 和 Bob,一共可以进行m次,Alice 先打.有一个白球和n个标有不同标号的球,称目标球为当前在桌子上的除了白球以外的数值最小的球,默认白球的标号为0.如果白 ...

  2. zoj 3757 Alice and Bob and Cue Sports 月赛A 模拟

    题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3757 题意:根据所给的台球规则,按照每次的结果计算最终两人的得分 ...

  3. zoj 3757 Alice and Bob and Cue Sports 模拟

    题目链接: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3757 #include<cstdio> #incl ...

  4. UVALive 3486/zoj 2615 Cells(栈模拟dfs)

    这道题在LA是挂掉了,不过还好,zoj上也有这道题. 题意:好大一颗树,询问父子关系..考虑最坏的情况,30w层,2000w个点,询问100w次,貌似连dfs一遍都会TLE. 安心啦,这肯定是一道正常 ...

  5. zoj 3757&&3758

    3757一个模拟题,简单,但容易错: 3758 大素数判定就行: #include<cstdio> #include<cstring> #include<algorith ...

  6. ZOJ 3633 Alice's present 倍增 区间查询最大值

    Alice's present Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/vi ...

  7. ZOJ 3326 An Awful Problem 模拟

    只有在 Month 和 Day 都为素数的时候才能得到糖 那就模拟一遍时间即可. //#pragma comment(linker, "/STACK:16777216") //fo ...

  8. HDU 4791 &amp; ZOJ 3726 Alice&#39;s Print Service (数学 打表)

    题目链接: HDU:http://acm.hdu.edu.cn/showproblem.php?pid=4791 ZJU:http://acm.zju.edu.cn/onlinejudge/showP ...

  9. ZOJ 2476 Total Amount 字符串模拟

    - Total Amount Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%lld & %llu Submit ...

随机推荐

  1. 使用python将请求的requests headers参数格式化方法

    import json # 使用三引号将浏览器复制出来的requests headers参数赋值给一个变量 headers = """ Host: zhan.qq.com ...

  2. 053、Java中使用for循环实现1~100的累加

    01.代码如下: package TIANPAN; /** * 此处为文档注释 * * @author 田攀 微信382477247 */ public class TestDemo { public ...

  3. 046、Java中使用if…else判断

    01.代码如下: package TIANPAN; /** * 此处为文档注释 * * @author 田攀 微信382477247 */ public class TestDemo { public ...

  4. Dive into re Module in Python

    Dive into RE in Python Standard re module in python is powerful to handle text manipulation,such as ...

  5. Jmeter安装插件Stepping Thread Group

    下载链接:https://jmeter-plugins.org/downloads/old/ 下载解压后,将JMeterPlugins-Standard.jar包放在jmeter安装目录的jmeter ...

  6. python中pip的安装问题

    当系统中同时存在python2.python3的时候,在进行pip下载的时总出现不知道用哪个 情况,此时就需要这样做: python2 -m pip install numpy //使用pip给pyt ...

  7. P1004 成绩排名

    转跳点:

  8. OpenMandriva或将放弃32位的支持

    导读 除了Ubuntu计划在其19.10发行版中删除32位包之外,OpenMandriva开发团队也是另一个备受关注的Linux发行版起草计划,以取消对32位包的支持. OpenMandriva计划在 ...

  9. nodejs 杂七杂八

    nodejs => 提供核心模块语法 node中的回调函数 都是异步

  10. nodejs 文件路径问题

    fs.stat()  是 获取 本目录下 文件信息 的方法 .如果使用要加上绝对路径.不然会出问题.例: 解决方法