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. ...
随机推荐
- SVN 升级后出现You need to upgrade the working copy first.
今天将svn更新后,出现 svn: The working copy at 'E:\591woospace\kst_fashion_alipay_v1.2.0\src\com\kstapp\wansh ...
- Linux系统启动过程分析
[原创]Linux系统启动过程分析-wjlkoorey258-ChinaUnix博客http://blog.chinaunix.net/uid-23069658-id-3142047.html 经过对 ...
- ytu 1064: 输入三个字符串,按由小到大的顺序输出(水题,字符串处理)
1064: 输入三个字符串,按由小到大的顺序输出 Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 471 Solved: 188[Submit][Sta ...
- POJ2065 SETI(高斯消元 同模方程)
(a1 * 1^0 + a2 * 1^1 + ... an * 1^n - 1) % P = f1 .... (a1 * n^0 + a2 * n^1 + ... an - 1 * ...
- AOP常用术语
1.连接点(Joinpoint) 程序执行的某个特定位置:如类开始初始化前,类初始化后,类某个方法调用前,调用后,方法跑出异常后.一个类或一段程序代码拥有一些具有边界性质的特定点.这些代码中的特定点就 ...
- hdu 4273 2012长春赛区网络赛 三维凸包中心到最近面距离 ***
新模板 /* HDU 4273 Rescue 给一个三维凸包,求重心到表面的最短距离 模板题:三维凸包+多边形重心+点面距离 */ #include<stdio.h> #include&l ...
- Get open Popups
public IEnumerable<Popup> GetOpenPopups() { return PresentationSource.CurrentSources.OfType< ...
- python 简单的txt文件读写
1 读取txt文件.跟c相比,python的文件读写简直是方便的可怕 首先是读取文件 首先获得文件名称,然后通过 open函数打开文件,通过for循环逐行读出文件内容 #!python file by ...
- Nginx支持多站点配置小结
如何配置 web 服务器才能在一个 VPS 上放置多个网站/博客呢?如何通过一个 IP 访问多个站点/域名呢?这是大多数 web 服务器支持的 virtual hosting 功能.即一个IP对应多个 ...
- 课堂随笔 set (集合)
1.什么是集合:set (集合)为无序不重复的序列. 2.如何创建一个集合:(1)set() 这样就创建了一个空的集合(2)s1={11,22,33}这样也创建了一个集合.(3)s2=set([ ...