题目链接

这题挺水,看懂了,就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的更多相关文章

  1. 1287. Mars Canals(DP)

    1287 水DP #include <iostream> #include<cstdio> #include<cstring> #include<algori ...

  2. ural 1294 Mars Satellites

    #include <cstdio> #include <cstring> #include <cmath> #include <algorithm> u ...

  3. 【最近公共祖先】【线段树】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 ...

  4. URAL - 1902 Neo-Venice

    题目: Mars was the first planet colonized by humans. After a long terraforming process its appearance ...

  5. 哈希URAL 1941 - Scary Martian Word

    A - Scary Martian Word Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I ...

  6. 【腾讯Bugly干货分享】微信终端跨平台组件 Mars 系列 - 我们如约而至

    导语 昨天上午,微信在广州举办了微信公开课Pro.于是,精神哥这两天的朋友圈被小龙的"八不做"刷屏了.小伙伴们可能不知道,下午,微信公开课专门开设了技术分论坛.在分论坛中,微信开源 ...

  7. 【腾讯Bugly干货分享】微信终端跨平台组件 mars 系列(二) - 信令传输超时设计

    本文来自于腾讯Bugly公众号(weixinBugly),未经作者同意,请勿转载,原文地址:http://mp.weixin.qq.com/s/9DJxipJaaBC8yC-buHgnTQ 作者简介: ...

  8. 如约而至:微信自用的移动端IM网络层跨平台组件库Mars已正式开源

    1.前言 关于微信内部正在使用的网络层封装库Mars开源的消息,1个多月前就已满天飞(参见<微信Mars:微信内部正在使用的网络层封装库,即将开源>),不过微信团队没有失约,微信Mars ...

  9. hdu4059 The Boss on Mars(差分+容斥原理)

    题意: 求小于n (1 ≤ n ≤ 10^8)的数中,与n互质的数的四次方和. 知识点: 差分: 一阶差分: 设  则    为一阶差分. 二阶差分: n阶差分:     且可推出    性质: 1. ...

随机推荐

  1. php建立多层目录的函数

    /** *根据路径path建立多级目录 *$dir目标目录 $mode权限,0700表示最高权限 */ function makedir( $dir , $mode = "0700" ...

  2. Pyqt 中__init__(self,parent==None) parent理解

    参考: 在PyQt中,所有class都是从QObject派生而来,QWidget对象就可以有一个parent.这种parent-child关系主要用于两个方面: 没有parent的QWidget类被认 ...

  3. 【转载】python super的用法

    转载地址: http://blog.csdn.net/cxm19830125/article/details/20610533 super的用法是调用继承类的初始化方法,如下面的代码: class A ...

  4. 【翻译九】java-同步方法

    Synchronized Methods The Java programming language provides two basic synchronization idioms: synchr ...

  5. sdut 2445 小学数学

    小学数学 Time Limit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^ 题目描述 题目链接:http://acm.sdut.edu.cn/sdutoj/p ...

  6. CXF学习(3) wsdl文件

    <!--一次webservice调用,其实并不是方法调用,而是发送SOAP消息 ,即xml片段--> <!--以上一篇中的wsdl文档为例,这里我将注释写到文档中 --> &l ...

  7. 怎样打开64位 Ubuntu 的32位支持功能?

    转自:http://jingyan.baidu.com/article/7082dc1c539c15e40a89bd3e.html 大多数使用基于 Ubuntu/Debian 的发行版的人都更倾向于选 ...

  8. Ubuntu下Chromium for Android 源码的编译

    转自:http://blog.csdn.net/leer168/article/details/9146689 一.环境Ubuntu10.4.4 -desktop-amd64 + VMware Wor ...

  9. Git 基础操作

    [TOC] 在Linux上安装Git $ git --version #查看git的版本号 $ sudo apt-get install git # 安装git 创建版本库 $ git init # ...

  10. POJ——3264线段树

    题目: 输入两个数(m,n),m表示牛的头数,n表示查询的个数.查询时输入两个数(x,y),表示查询范围的起始值和终止值,查询结果是,这个区间内牛重量的最大值减去牛重量的最小值,数量级为1000,00 ...