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. ...
随机推荐
- EMC DATA DOMAIN 2200 filesys destroy(數據清空及重建)
EMC 數據清空 1.數據清空 這裡會清空file system的所有東西包括tapes
- wp8 入门到精通 启动系统分享照片任务
PhotoChooserTask photoChooserTask = new PhotoChooserTask(); photoChooserTask.Completed += photoChoos ...
- thinkphp分页样式
html代码: <div class="pages">{$page}</div> css代码: .pages{ width:100.5%; text-ali ...
- js判断访问的当前设备是手机还是电脑
function browserRedirect() { var sUserAgent = navigator.userAgent.toLowerCase(); var bIsIpad = sUser ...
- ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statemen
转自:http://www.cnblogs.com/iosdev/archive/2013/07/15/3190431.html mysql 配置文件目录:/etc/my.cnf root 密码为空的 ...
- ZLL网关程序分析
主机接口 zllSocCmd.h(ZLL的Socket主机接口) 此模块包含ZLL的Socket主机接口API.其包含的函数方法在zllSocCmd.c中实现 ZLL Soc Types 定义了描述设 ...
- office excel 装Visual Studio后报错解决方案
安装完vs后,vs会向office安装COM加载项,但是在启动Excel时会发生弹出此加载项安装出错的消息,如下图. 名称: 从: file:///D:/Program Files (x86)/Mic ...
- APP交互
交互设计基本功!5个值得学习的APP交互方式http://www.uisdc.com/5-interactive-design-worth-learning 移动App交互设计10大趋势–你用到了吗? ...
- HDU 1540 Tunnel Warfare 平衡树 / 线段树:单点更新,区间合并
Tunnel Warfare Time Limit: 4000/2000 MS (Java/Others) Memory Lim ...
- JSHint配置详解
Also available on Github JSHint配置详解 增强参数(Enforcing Options) 本类参数设为true,JSHint会产生更多告警. bitwise 禁用位运算符 ...