上次的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. C++ 语言程序设计(清华大学)2

    面向对象 1.面向对象程序基本特点:抽象.封装.继承.多态 2.类分为:公有类型成员public(接口),私有类型成员private(本类函数访问,类外要用友元函数访问),保护类型成员protect( ...

  2. 关于可持久化Trie

    我认为 可持久化Trie 主要指 可持久化01Trie 如洛谷P4735 将每个数的异或前缀和转化为二进制,添加前缀0至相同位数,然后从最高位开始插入,类似主席树,每一层都对需要更新的点加入一个新的点 ...

  3. 17 Resources AssetBundle资源打包

    Resources在Unity中可以使用www类加载远程文件或本地文件,或是在脚本中定义字段或数组从外部拖入. 在Unity中提供了Resources类读取资源要通过Resources类读取的文件必须 ...

  4. sql server 2012插入排序后的数据到临时表无效

    IF OBJECT_ID('TEMPDB..#list') IS NOT NULLBEGIN DROP TABLE TEMPDB.#list END CREATE TABLE #list(OFC_ID ...

  5. c++程序—选择结构

    if(判断条件){执行语句} #include<iostream> using namespace std; #include<string> int main() { ; c ...

  6. EditText监听器------实时监听

    前言: 在Android开发中EditText的使用频率还是挺高的,比如登录界面输入密码验证码等,有的时候要求我们要在输入号码后显示是哪家公司的,比如中国移动,中国联通,这是就会用到EditText监 ...

  7. P1082 射击比赛

    P1082 射击比赛 转跳点:

  8. (win32)解决虚拟按键被输入法截获(转)

    源博客地址:http://blog.csdn.net/kencaber/article/details/51417871 响应WM_KEYDOWN消息时发现`~快捷键无效,设置断点发现得到的按键消息根 ...

  9. 解决CSS背景模糊

    .banner{ background:url(banner.jpg); -moz-background-size:100% 100%; background-size:100% 100%; }

  10. 地图js及json包

    echarts github上的地图js及json包:https://github.com/apache/incubator-echarts/tree/master/map 上面链接没有县及的地图js ...