UVALive 7512 November 11th 题解
思路:心态大崩,最多不讲了,最少应该是三个一组,比如......应该是.S..S.,这样占的最多
代码:
#include<set>
#include<map>
#include<cmath>
#include<queue>
#include<string>
#include<cstdio>
#include<cstring>
#include<sstream>
#include<algorithm>
typedef long long ll;
using namespace std;
const int maxn = + ;
const int MOD = 1e9 + ;
const int INF = 0x3f3f3f3f;
int row[maxn][maxn], cnt[maxn];
int getMax(int s){
return (s + ) / ;
}
int getMin(int s){
if(s % == ){
return s / ;
}
else if(s % == ){
return (s + ) / ;
}
else return (s + ) / ;
}
int main(){
int t, ca = ;
scanf("%d", &t);
while(t--){
int b, r, s;
scanf("%d%d", &r, &s);
scanf("%d", &b);
memset(cnt, ,sizeof(cnt));
for(int i = ; i <= b; i++){
int x, y;
scanf("%d%d", &x, &y);
row[x][cnt[x]++] = y;
}
int Max = , Min = ;
for(int i = ; i < r; i++){
if(cnt[i] == ){
Max += getMax(s);
Min += getMin(s);
}
else{
sort(row[i], row[i] + cnt[i]);
for(int j = ; j < cnt[i]; j++){
if(j == ){
int tmp = row[i][j] - ;
Max += getMax(tmp);
Min += getMin(tmp);
}
else{
int tmp = row[i][j] - row[i][j - ] - ;
Max += getMax(tmp);
Min += getMin(tmp);
}
}
int tmp = s - - row[i][cnt[i] - ];
Max += getMax(tmp);
Min += getMin(tmp);
}
}
printf("Case #%d: %d %d\n", ca++, Max, Min);
}
return ;
}
/*
3
2 3
1
0 1
2 3
0
1 1
1
0 0
*/
UVALive 7512 November 11th 题解的更多相关文章
- UVaLive 7512 November 11th (思维漏洞)
题意:给定n*m个座椅,然后有b个是坏的,要做人,并且两个人不能相邻,问你最多坐多少人,最少坐多少人. 析:这个题其实并不难,只要当时一时没想清楚,结果就一直WA,就是最少的情况时,其实一个人可以占三 ...
- UVALive 6124 Hexagon Perplexagon 题解
http://vjudge.net/problem/viewProblem.action?id=37480 East Central Regional Contest Problem C: Hexag ...
- UVALive 2521 Game Prediction 题解
这个我上来把题目理解错了,我以为所有人的牌都是一样的,感觉这个题太麻烦了吧,而且题目样例过不去啊……后来发现理解错了,给出的数据是他一个人的数据,就是让我们求他一定能赢的轮数,所有的牌是固定的(1 - ...
- November 11th 2016 Week 46th Friday
Keep in mind that neither success nor failure is ever final. 无论成败,皆非定局. The final is not coming, but ...
- November 11th, 2017 Week 45th Saturday
Happiness is a direction, not a place. 快乐是一个方向,不是一个目的. Do you remember those moments in your life wh ...
- The 2013 South America/Brazil Regional Contest 题解
A: UVALive 6525 cid=61196#problem/A" style="color:blue; text-decoration:none">Atta ...
- 2015 ACM/ICPC EC-Final
A. Boxes and Balls 二分找到最大的不超过$n$的$\frac{x(x+1)}{2}$形式的数即可. #include <bits/stdc++.h> using name ...
- 任务调度框架-Quartz.Net
使用Quartz.Net依赖于以下3个组件:Common.Logging.dll.Common.Logging.Core.dll.Quartz.dll 简单封装 using Quartz; using ...
- Quartz.net(调度框架) 使用Mysql作为存储
最近公司的做的项目中涉及到配置任务地址然后按照配置去目标地址提取相关的数据,所以今天上午在Internet上查看有关定时任务(调度任务)的相关信息,筛选半天然后查找到Quartz.net. Quart ...
随机推荐
- man查看帮助命令
man -h/-help 1.在man命令帮助信息的界面中,所包含的常用操作按键及其用途 按键 用处 空格键 向下翻一页 PaGe down 向下翻一页 PaGe up 向上翻一页 home 直接前往 ...
- jQuery属性--html([val|fn])、text([val|fn])和val([val|fn|arr])
html([val|fn]) 概述 取得第一个匹配元素的html内容,这个函数不能用于XML文档.但可以用于XHTML文档. 在一个 HTML 文档中, 我们可以使用 .html() 方法来获取任意一 ...
- 【2017-03-20】HTML框架,标题栏插入小图标,锚点,插入音频视频,滚动效果
一.html框架 iframe 在网页中嵌入一个别的网页 1.格式: <iframe src="链接地址" width="" height=&quo ...
- MySql 存储过程 退出
mysql不支持quit, exit或return的方式退出编写存储过程时,为了业务规则需要,我们可能需要提前退出存储过程那么,我们可以利用leave label方式模拟实现quit退出的效果应用示例 ...
- 写自动更新程序出现"远程服务器返回错误: (404) 未找到"
在win2003配置后,在客户端运行时能够下载exe和dll文件,但是在更新lib文件时总是报“远程服务器返回错误: (404) 未找到”错误,不明白咋会出现这个问题,去网上一查,发现以下解决办法: ...
- mybatis源码解析7---MappedStatement初始化过程
上一篇我们了解到了MappedStatement类就是mapper.xml中的一个sql语句,而Configuration初始化的时候会加载所有的mapper接口类,而本篇再分析下是如何将mapper ...
- eclipse 依赖别的 工程 断点进不去
maven Debug 发现进不了断点. 点击右键-->Properties-->Java Compiler-->Classfile Generation, 勾选上Add line ...
- hud1007 Quoit Design
#include<algorithm> #include<iostream> #include<cstdlib> #include<cstring> # ...
- java加载配置文件信息
#基金数据存放根目录fund_save_root_path=E:/fundCrawling #龙虎榜数据存放根目录long_hu_root_path=E:/longHuCrawling #巨潮数据存放 ...
- Linux shell 时间操作(取昨天 前天)
1. 取今天时间 $date -d "now" +%Y-%m-%d 2. 取昨天时间 $date -d "yesterday" +%Y-%m-%d $date ...