acdream 1044
题意:有你一个草坪,草的初始高度都是100,让你用割草机割,割草机只能横着或竖着割,每次割的高度一定,问你能不能割出给定的草坪出来。
考虑任意一个草被割要么是横着要么竖着,所以任意一个草必然是它所在行或列里面高度最大(或相等)的,因此如果存在一个草在它所在的行和列里都不是最大的则无法割出给定的草坪。
/*
* this code is made by wangzhili
* Problem: 1044
* Verdict: Accepted
* Submission Date: 2014-08-08 20:30:21
* Time: 12MS
* Memory: 1724KB
*/
#include<map>
#include<cmath>
#include<queue>
#include<cstdio>
#include<string>
#include<vector>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int mat[111][111];
int main(){
int t, n, m;
scanf("%d", &t);
for(int CASE = 1;CASE <= t; CASE ++){
scanf("%d%d", &n, &m);
for(int i = 0;i < n;i ++){
for(int j = 0;j < m;j ++) scanf("%d", &mat[i][j]);
}
int flag = 0;
for(int i = 0;i < n;i ++){
for(int j = 0;j < m;j ++){
int cnt = 0;
for(int k = 0;k < m;k ++){
if(mat[i][j] < mat[i][k]){
cnt ++;
break;
}
}
for(int k = 0;k < n;k ++){
if(mat[i][j] < mat[k][j]){
cnt ++;
break;
}
}
if(cnt == 2){
flag = 1;
break;
}
}
if(flag) break;
}
printf("Case #%d: ", CASE);
if(flag) printf("NO\n");
else printf("YES\n");
}
return 0;
}
acdream 1044的更多相关文章
- BZOJ 1044 木棍分割 解题报告(二分+DP)
来到机房刷了一道水(bian’tai)题.题目思想非常简单易懂(我的做法实际上参考了Evensgn 范学长,在此多谢范学长了) 题目摆上: 1044: [HAOI2008]木棍分割 Time Limi ...
- 一看便知linux下mysql报错ERROR 1044: Access denied for user: '@localhost' to database 'mysql'
错误信息:ERROR 1044: Access denied for user: '@localhost' to database 'mysql' linux下解决方案: mysql> use ...
- BZOJ 1044: [HAOI2008]木棍分割
Description 求 \(n\) 根木棍长度为 \(L\) ,分成 \(m\) 份,使最长长度最短,并求出方案数. Sol 二分+DP. 二分很简单啊,然后就是方案数的求法. 状态就是 \(f[ ...
- nested exception is com.mysql.jdbc.PacketTooBigException: Packet for query is too large (1044 > 1024
HTTP Status 500 - type Exception report message description The server encountered an internal error ...
- ACdream 1214---矩阵连乘
ACdream 1214---矩阵连乘 Problem Description You might have noticed that there is the new fashion among r ...
- 解决mysqldump: Got error: 1044: Access denied for user
转自:http://blog.slogra.com/post-512.html 今天给新加的几个数据库备份,在执行mysqldump的时候,居然报mysqldump: Got error: 1044: ...
- acdream.LCM Challenge(数学推导)
LCM Challenge Time Limit:1000MS Memory Limit:64000KB 64bit IO Format:%lld & %llu Submit ...
- acdream.Triangles(数学推导)
Triangles Time Limit:1000MS Memory Limit:64000KB 64bit IO Format:%lld & %llu Submit Stat ...
- acdream.A Very Easy Triangle Counting Game(数学推导)
A - A Very Easy Triangle Counting Game Time Limit:1000MS Memory Limit:64000KB 64bit IO Forma ...
随机推荐
- lintcode :Valid Palindrome 有效回文串
题目: 有效回文串 给定一个字符串,判断其是否为一个回文串.只包含字母和数字,忽略大小写. 样例 "A man, a plan, a canal: Panama" 是一个回文. & ...
- Linux中断处理体系结构分析
Linux中断处理体系结构分析(一) 异常,就是可以打断CPU正常运行流程的一些事情,比如外部中断.未定义指令.试图修改只读的数据.执行swi指令(Software Interrupt Instruc ...
- WCF入门(十)---WCF事务
事务处理在WCF(Windows Communication Foundation)是一套遵循一些性质,统称为ACID的操作.这里,如果一个操作出现故障,整个系统就会自动失败.如网上订单生成,就可能使 ...
- iOS 使用COPY声明NSSTRING属性
使用COPY声明NSSTRING属性 2014/05/29 JACE 发表回复 声明一个NSString属性使用copy要优于使用strong.这同样适用于遵守NSCoding协议的不可变类(immu ...
- 248. Strobogrammatic Number III
题目: A strobogrammatic number is a number that looks the same when rotated 180 degrees (looked at ups ...
- openfire 介绍安装使用
Openfire 采用Java开发,开源的实时协作(RTC)服务器基于XMPP(Jabber)协议.Openfire安装和使用都非常简单,并利用Web进行管理.单台服务器可支持上万并发用户.您可以使用 ...
- json格式的字符串转为json对象遇到特殊字符问题解决
中午做后台发过来的json的时候转为对象,可是有几条数据一直出不来,检查发现json里包含了换行符,造成这种情况的原因可能是编辑部门在编辑的时候打的回车造成的 假设有这样一段json格式的字符串 va ...
- c#关键字详解
c#关键字 关键字是对编译器有特殊意义的预定义的保留标识符.它们不能在程序中用作普通标识符,除非在它们前面加上@前缀. 第一部分 一.访问关键字:base,this base:访问基类的成员. 用 ...
- MyEclipse开发WebService教程
. 创建一个 webService 工程. 2. 创建一个普通 Java 类 3. 创建 webService 服务端 HelloJaxwsDelegate.java 的源代码如下: 4. 导 ...
- openfire中mysql的前期设置
使用openfire的时候如果需要使用自己的mysql数据库,需要提前进行设置,下面将记录下,基本的设置过程. 一.前期准备工作: 1.先下载两个工具一个是mysql数据库还有一个是SQLyog(可以 ...