BZOJ 3208: 花神的秒题计划Ⅰ
这就是一道滑雪嘛= =
所有操作都爆力,求路径就dp,完了
CODE:
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
#define maxn 710
#define inf 0x7fffffff
bool bo[maxn][maxn],b[maxn][maxn];
int f[maxn][maxn],a[maxn][maxn];
int way[4][2]={{1,0},{-1,0},{0,-1},{0,1}};
int dfs(int x,int y){
if (bo[x][y]||b[x][y]) return f[x][y];
int ans=0;
bo[x][y]=1;
for (int i=0;i<4;i++)
if (a[x][y]>a[x+way[i][0]][y+way[i][1]])
ans=max(dfs(x+way[i][0],y+way[i][1]),ans);
ans++;
f[x][y]=ans;
return ans;
}
char s[2];
int main(){
int n,m;
scanf("%d",&n);
for (int i=1;i<=n;i++)
for (int j=1;j<=n;j++) scanf("%d",&a[i][j]);
for (int i=1;i<=n;i++) a[i][0]=a[0][i]=a[i][n+1]=a[n+1][i]=inf;
scanf("%d",&m);
while (m--){
scanf("%s",s);
int x1,y1,x2,y2,x;
if (s[0]=='C'){
scanf("%d%d%d",&x1,&y1,&x);
a[x1][y1]=x;
}
if (s[0]=='S'){
scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
for (int i=x1;i<=x2;i++)
for (int j=y1;j<=y2;j++) b[i][j]=1;
}
if (s[0]=='B'){
scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
for (int i=x1;i<=x2;i++)
for (int j=y1;j<=y2;j++) b[i][j]=0;
}
if (s[0]=='Q'){
memset(bo,0,sizeof(bo));
memset(f,0,sizeof(f));
int ans=0;
for (int i=1;i<=n;i++)
for (int j=1;j<=n;j++)
ans=max(ans,dfs(i,j));
printf("%d\n",ans);
}
}
return 0;
}
BZOJ 3208: 花神的秒题计划Ⅰ的更多相关文章
- bzoj 3208 花神的秒题计划I
bzoj 3208 花神的秒题计划I Description 背景[backboard]: Memphis等一群蒟蒻出题中,花神凑过来秒题-- 描述[discribe]: 花花山峰峦起伏,峰顶常年被雪 ...
- bzoj3208: 花神的秒题计划Ⅰ
3208: 花神的秒题计划Ⅰ Time Limit: 16 Sec Memory Limit: 128 MBSubmit: 323 Solved: 211[Submit][Status] Desc ...
- BZOJ-3208|记忆化搜索-花神的秒题计划Ⅰ
背景[backboard]: Memphis等一群蒟蒻出题中,花神凑过来秒题-- 描述[discribe]: 花花山峰峦起伏,峰顶常年被雪,Memphis打算帮花花山风景区的人员开发一个滑雪项目. 我 ...
- BZOJ3208:花神的秒题计划Ⅰ(记忆化搜索DP)
Description 背景[backboard]: Memphis等一群蒟蒻出题中,花神凑过来秒题…… 描述[discribe]: 花花山峰峦起伏,峰顶常年被雪,Memphis打算帮花花山风景区 ...
- bzoj3208:花神的秒题计划I
思路:因为Q.S.B操作总和不超过100,因此怎么暴力怎么写....当然记忆化搜索还是要的 #include<cstdio> #include<iostream> #inclu ...
- 【记忆化搜索】bzoj3208 花神的秒题计划Ⅰ
暴力 #include<cstdio> #include<cstring> #include<algorithm> using namespace std; #de ...
- 【bzoj3208】花神的秒题计划Ⅰ
记忆化搜索 #include<algorithm> #include<iostream> #include<cstring> #include<cstdlib ...
- bzoj 前100题计划
bzoj前100题计划 xz布置的巨大的坑.. 有空填题解... 1002 轮状病毒 用python手动matrixtree打表. #include<bits/stdc++.h> #def ...
- BZOJ第一页刷题计划
BZOJ第一页刷题计划 已完成:67 / 90 [BZOJ1000]A+B Problem:A+B: [BZOJ1001][BeiJing2006]狼抓兔子:最小割: [BZOJ1002][FJOI2 ...
随机推荐
- Hibernate 继承表结构
有Product , Book ,Clothes三张表 Product:id,name Book: id ,name,pageCount Clothes: id ,name ,size 创建三张表 产 ...
- java实现gbdt
DATA类 import java.io.File; import java.io.FileNotFoundException; import java.util.ArrayList; import ...
- 博客停更及OI退役公告
停更&&OI退役 公告 高中OI之路就这样结束了,曾经想过回在NOI跪,APIO跪,HNOI跪却从未想过会在NOIP跪! 没办法自己作死啊,CCF感觉还是很良心的混个省一回来了,看以后 ...
- xamarin mac 基础知识 之 界面
有两种方式创建界面:代码和xaml
- deviceOne -- js的本地搜索
// 搜索 function search_by_PY(pinyin) { // 置空 var after_search_listData = []; // 清空数据 do_listData.remo ...
- DELPHI中MessageBox的用法
MessageBox对话框 输入控件的 ImeName属性把输入法去掉就默认为英文输入了 MessageBox对话框是比较常用的一个信息对话框,其不仅能够定义显示的信息内容.信息提示图标,而且可以 ...
- SpringMVC详解
来源:Sunnier(http://www.admin10000.com/document/6436.html) 一.SpringMVC基础入门,创建一个HelloWorld程序 1.首先,导入Spr ...
- 浅谈Log4j
1 什么是Log4j Log4j 是Apache为Java提供的日志管理工具.为了你快速理解Log4j的作用,我们用下面的代码说明Log4j的作用.我们为了调试程序,总是需要在程序使用System.o ...
- .net 设置版本号信息
1.AssemblyInfo.cs [assembly: AssemblyVersion("1.3.170116")] [assembly: AssemblyFileVersion ...
- MonthCalendar控件
MonthCalendar控件 功能,直接显示月历,