URAL 1287. Mars Canals
这题挺水,看懂了,就OK。卡了几下内存,还是卡过了。
#include <iostream>
#include <cstdio>
#include <cstring>
#include <queue>
#include <map>
#include <ctime>
#include <cmath>
#include <algorithm>
using namespace std;
#define N 1403
int r[N][N][],c[N][N][];
int r1[N][N][],c1[N][N][];
char str[N][N];
int main()
{
int i,j,n,t;
scanf("%d",&n);
for(i = ;i < n;i ++)
scanf("%s",str[i]);
for(i = ;i <= n;i ++)
{
for(j = ;j <= n;j ++)
{
t = str[i-][j-] == 's'?:;
r[i][j][t] = r[i-][j][t] + ;
c[i][j][t] = c[i][j-][t] + ;
r1[i][j][t] = r1[i-][j-][t] + ;
c1[i][j][t] = c1[i-][j+][t] + ;
r[i][j][t^] = ;
c[i][j][t^] = ;
r1[i][j][t^] = ;
c1[i][j][t^] = ;
}
}
int max1,max2;
max1 = max2 = ;
for(i = ;i <= n;i ++)
{
for(j = ;j <= n;j ++)
{
t = str[i-][j-] == 's'?:;
if(t)
max1 = max(max1,max(max(r[i][j][],c[i][j][]),max(r1[i][j][],c1[i][j][])));
else
max2 = max(max2,max(max(r[i][j][],c[i][j][]),max(r1[i][j][],c1[i][j][])));
}
}
if(max1 > max2)
printf("s\n%d\n",max1);
else if(max1 < max2)
printf("S\n%d\n",max2);
else
printf("?\n%d\n",max1);
return ;
}
URAL 1287. Mars Canals的更多相关文章
- 1287. Mars Canals(DP)
1287 水DP #include <iostream> #include<cstdio> #include<cstring> #include<algori ...
- ural 1294 Mars Satellites
#include <cstdio> #include <cstring> #include <cmath> #include <algorithm> u ...
- 【最近公共祖先】【线段树】URAL - 2109 - Tourism on Mars
Few people know, but a long time ago a developed state existed on Mars. It consisted of n cities, nu ...
- URAL - 1902 Neo-Venice
题目: Mars was the first planet colonized by humans. After a long terraforming process its appearance ...
- 哈希URAL 1941 - Scary Martian Word
A - Scary Martian Word Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I ...
- 【腾讯Bugly干货分享】微信终端跨平台组件 Mars 系列 - 我们如约而至
导语 昨天上午,微信在广州举办了微信公开课Pro.于是,精神哥这两天的朋友圈被小龙的"八不做"刷屏了.小伙伴们可能不知道,下午,微信公开课专门开设了技术分论坛.在分论坛中,微信开源 ...
- 【腾讯Bugly干货分享】微信终端跨平台组件 mars 系列(二) - 信令传输超时设计
本文来自于腾讯Bugly公众号(weixinBugly),未经作者同意,请勿转载,原文地址:http://mp.weixin.qq.com/s/9DJxipJaaBC8yC-buHgnTQ 作者简介: ...
- 如约而至:微信自用的移动端IM网络层跨平台组件库Mars已正式开源
1.前言 关于微信内部正在使用的网络层封装库Mars开源的消息,1个多月前就已满天飞(参见<微信Mars:微信内部正在使用的网络层封装库,即将开源>),不过微信团队没有失约,微信Mars ...
- hdu4059 The Boss on Mars(差分+容斥原理)
题意: 求小于n (1 ≤ n ≤ 10^8)的数中,与n互质的数的四次方和. 知识点: 差分: 一阶差分: 设 则 为一阶差分. 二阶差分: n阶差分: 且可推出 性质: 1. ...
随机推荐
- hdu 1251:统计难题(字典树,经典题)
统计难题 Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 131070/65535 K (Java/Others)Total Submi ...
- SQL SERVER 统计信息概述(Statistics)
前言 查询优化器使用统计信息来创建可提高查询性能的查询计划,对于大多数查询,查询优化器已经为高质量查询计划生成必要的统计信息,但是在少数情况下,您需要创建附加的统计信息或者修改查询设计以得到最佳结果. ...
- 用PHPcms V9四步完成WAP手机站搭建
用PHPCMS最新发布的V9搭建了ONOW中文网,WEB网站(www.onow.cn)完成后,有用户提供手机访问的问题, 于是着手搭建ONOW手机WAP站(3g.onow.cn). 用PHPCMS V ...
- loj 1379(最短路变形)
题目链接:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=27087 思路:题目的意思是求S->T的所有路径中花费总和小于 ...
- objective-c 遍历文件夹查看文件
#import <Foundation/Foundation.h>int main (int argc, const char * argv[]){ @autoreleasepool ...
- Windows MDL原理总结
http://blog.csdn.net/tbwood/article/details/5400419 http://www.cnblogs.com/jack204/archive/2011/12/2 ...
- AchartEngine 的学习
第一步:我使用的事AchartEngine 1.1.0 的包.大家要先下在这个包,放到项目中,创建一个lib文件夹.然后倒金项目中去.然后再AndroidManifest.xml 中需要注册一下代码是 ...
- android应用程序如何调用支付宝接口
最近在做一个关于购物商城的项目,项目里面付款这块我选的是调用支付宝的接口,因为用的人比较多. 在网上搜索了以下,有很多这方面的教程,但大部分教程过于陈旧,而且描述的过于简单.而且支付宝提供的接口一直在 ...
- host_network_interfaces_slow_mode_thresholds
CDH报集群异常: host_network_interfaces_slow_mode_thresholds 警告置为从不-- 主要是我没有查到发生这种情况的原因是什么--
- 解读Web Page Diagnostics网页细分图
解读Web Page Diagnostics网页细分图 http://blog.sina.com.cn/s/blog_62b8fc330100red5.html Web Page Diagnostic ...