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 ...
随机推荐
- kali linux 基本命令(第一批)
pwd , rm ,locate ,cat ,head , clear ,ls ,cd ,mkdir ,touch ,ec ...
- Windsor
https://github.com/castleproject/Windsor https://github.com/castleproject/Windsor/blob/master/docs/R ...
- 转:C#线程系列讲座(1) BeginInvoke和EndInvoke方法
转载自:http://www.cnblogs.com/levin9/articles/2319248.html 开发语言:C#3.0IDE:Visual Studio 2008本系列教程主要包括如下内 ...
- 多选插件multiselect.js
官方网址:http://loudev.com/ html: <html> <head> <link href="path/to/multiselect.css& ...
- python初学者必看的学习路线
Python是近几年比较火的编程语言之一,因为人工智能的火爆,让很多人都想从事python开发.很多零基础学员在学习python的时候都会走一些弯路,下面小编就为大家分享python学习路线图,帮助零 ...
- EditPlus5.0注册码
EditPlus5.0注册码 注册名 Vovan 注册码 3AG46-JJ48E-CEACC-8E6EW-ECUAW EditPlus3.x注册码 EditPlus注册码生成器链接 http://ww ...
- Qt 文本文件的打开、新建、保存以及另存为
我们平时在使用windows的notepad以及其他各种软件过程中,都会有保存文件和另存为两种功能,这两者不能混为一谈. 一.保存时有两种情况,一种是对于新创建的文件,一种是对于已有的文件,前者需要打 ...
- Tomcat启动报错:[The configuration may be corrupt or incomplete]的解决方案
1,场景说明: 偶然碰见Tomcat启动报错,此时并没有Add任何Web项目: Could not load the Tomcat server configuration at /Servers/T ...
- camera按键采集图像及waitKey的用法(转)
源: camera按键采集图像及waitKey的用法
- BeanCreationException: Error creating bean with name 'transactionManager' defined
BeanCreationException: Error creating bean with name 'transactionManager' defined in \WEB-INF\classe ...