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 Bod 模拟的更多相关文章
- ZOJ 3757 Alice and Bob and Cue Sports(模拟)
题目链接 题意 : 玩台球.Alice 和 Bob,一共可以进行m次,Alice 先打.有一个白球和n个标有不同标号的球,称目标球为当前在桌子上的除了白球以外的数值最小的球,默认白球的标号为0.如果白 ...
- zoj 3757 Alice and Bob and Cue Sports 月赛A 模拟
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3757 题意:根据所给的台球规则,按照每次的结果计算最终两人的得分 ...
- zoj 3757 Alice and Bob and Cue Sports 模拟
题目链接: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3757 #include<cstdio> #incl ...
- UVALive 3486/zoj 2615 Cells(栈模拟dfs)
这道题在LA是挂掉了,不过还好,zoj上也有这道题. 题意:好大一颗树,询问父子关系..考虑最坏的情况,30w层,2000w个点,询问100w次,貌似连dfs一遍都会TLE. 安心啦,这肯定是一道正常 ...
- zoj 3757&&3758
3757一个模拟题,简单,但容易错: 3758 大素数判定就行: #include<cstdio> #include<cstring> #include<algorith ...
- ZOJ 3633 Alice's present 倍增 区间查询最大值
Alice's present Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/vi ...
- ZOJ 3326 An Awful Problem 模拟
只有在 Month 和 Day 都为素数的时候才能得到糖 那就模拟一遍时间即可. //#pragma comment(linker, "/STACK:16777216") //fo ...
- HDU 4791 & ZOJ 3726 Alice's Print Service (数学 打表)
题目链接: HDU:http://acm.hdu.edu.cn/showproblem.php?pid=4791 ZJU:http://acm.zju.edu.cn/onlinejudge/showP ...
- ZOJ 2476 Total Amount 字符串模拟
- Total Amount Time Limit:2000MS Memory Limit:65536KB 64bit IO Format:%lld & %llu Submit ...
随机推荐
- 7.8 Varnish 其他命令
- leeetcode1171 Remove Zero Sum Consecutive Nodes from Linked List
""" Given the head of a linked list, we repeatedly delete consecutive sequences of no ...
- Golang的进制转换实战案例
Golang的进制转换实战案例 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.常用进制概述 1>.进制概述 进制也就是进位制,是人们规定的一种进位方法.举个例子:二进制就 ...
- P1055 集体照
P1055 集体照 转跳点:
- C++面试常见问题——06数组排序
数组排序 冒泡.最简单的冒泡,没啥好讲的 #include<iostream> using namespace std; void BubbleSort(int a[],int len){ ...
- 利用Jenkins实现jdk11+Maven构建springboot项目
目录 原理图 前期准备 Jdk11安装 Jenkins安装 Maven安装 Jenkins的设置 插件安装 变量配置 搭建项目 1.通用配置 2.源码管理 3.构建触发 4.Maven的构建选项 5. ...
- 75.Python中ORM聚合函数详解:Sum
Sum:某个字段的总和. 1. 求图书的销售总额,示例代码如下: from django.http import HttpResponse from django.db import connecti ...
- 3. SSH 服务器安装
1.查看SSH是否安装(检查是否装了SSH包) 输入命令:rpm -qa | grep ssh 2.安装SSH 服务 yum install openssh-server 3.查看SSH服务是否正在运 ...
- HDU 4862 JUMP 最小费用最大流
2014 多校的B题,由于我不怎么搞图论,当时碰到这个题目,我怎么想都没往网络流方面弄,不过网络流真的是个好东西,对于状态多变,无法用动规或者数据结构来很好表示的时候,非常有用 这个题目要求每个点一定 ...
- Elasticsearch核心概念
Elasticsearch 核心概念 Cluster 代表一个集群, 集群中有多个节点, 其中一个为主节点, 该节点可以通过选举产生.(主从节点只针对于集群内部) 去中心化: 对于集群外来说无中心节点 ...