题意:有你一个草坪,草的初始高度都是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的更多相关文章

  1. BZOJ 1044 木棍分割 解题报告(二分+DP)

    来到机房刷了一道水(bian’tai)题.题目思想非常简单易懂(我的做法实际上参考了Evensgn 范学长,在此多谢范学长了) 题目摆上: 1044: [HAOI2008]木棍分割 Time Limi ...

  2. 一看便知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 ...

  3. BZOJ 1044: [HAOI2008]木棍分割

    Description 求 \(n\) 根木棍长度为 \(L\) ,分成 \(m\) 份,使最长长度最短,并求出方案数. Sol 二分+DP. 二分很简单啊,然后就是方案数的求法. 状态就是 \(f[ ...

  4. 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 ...

  5. ACdream 1214---矩阵连乘

    ACdream 1214---矩阵连乘 Problem Description You might have noticed that there is the new fashion among r ...

  6. 解决mysqldump: Got error: 1044: Access denied for user

    转自:http://blog.slogra.com/post-512.html 今天给新加的几个数据库备份,在执行mysqldump的时候,居然报mysqldump: Got error: 1044: ...

  7. acdream.LCM Challenge(数学推导)

     LCM Challenge Time Limit:1000MS     Memory Limit:64000KB     64bit IO Format:%lld & %llu Submit ...

  8. acdream.Triangles(数学推导)

    Triangles Time Limit:1000MS     Memory Limit:64000KB     64bit IO Format:%lld & %llu Submit Stat ...

  9. acdream.A Very Easy Triangle Counting Game(数学推导)

    A - A Very Easy Triangle Counting Game Time Limit:1000MS     Memory Limit:64000KB     64bit IO Forma ...

随机推荐

  1. 李洪强漫谈iOS开发[C语言-007]-语言标准简介

    C语言是介于低级语言和高级语言之间的 一个应用程序 C语言在嵌入式上使用,的确是具有低级语言的特征 直接操作硬件,扫描内存 访问到的都是虚拟内存,一个应用程序占多大内存? 表示最多 可以放多少条指令 ...

  2. Winsock完成端口模型-Delphi代码

    原文出处 <Windows网络编程技术>第8章 完成端口模型 由于原书附的是C代码,我把其翻译成Delphi代码. 其中winsock2.pas在delphi中不带,要另外下载http:/ ...

  3. jQuery好用插件

    jQuery图片轮播插件(smallslider):http://fz.sjtu.edu.cn/zsw/js/smallslider/ jQuery消息通知(noty):http://www.360d ...

  4. IDEA查找功能小结

    查找类:Ctrl + N 支持模糊查询

  5. android actionbar标题栏

    在android的actionBar中,actionBar的视图是固定的,左边是程序的图标和title,右边是添加的menuItem,如果想要定制actionbar中的view就要自定义视图. 首先要 ...

  6. 解决Cygwin中vim的backspace不能正常使用(转)

    转载于:http://blog.chinaunix.net/uid-20614631-id-1914849.html  亲测可用 先把Cygwin下载下来,想在linux下编程的话一定要安装vim,g ...

  7. SimpleDateFormat日期格式化

    public class T { /** * @param args */ public static void main(String[] args) { // TODO Auto-generate ...

  8. C/C++面试题(一)

    1.手写快速排序 void quick_sort(int s[], int l, int r) { if (l < r) { //Swap(s[l], s[(l + r) / 2]); //将中 ...

  9. ios跳转

    目标应用程序:打开info.plist,添加一项URL types展开URL types,再展开Item1,将Item1下的URL identifier修改为URL Scheme展开URL Schem ...

  10. 【POJ】3134 Power Calculus

    1. 题目描述给定一个正整数$n$,求经过多少次乘法或除法运算可以从$x$得到$x^n$?中间结果也是可以复用的. 2. 基本思路实际结果其实非常小,肯定不会超过20.因此,可以采用IDA*算法.注意 ...