这就是一道滑雪嘛= =

所有操作都爆力,求路径就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: 花神的秒题计划Ⅰ的更多相关文章

  1. bzoj 3208 花神的秒题计划I

    bzoj 3208 花神的秒题计划I Description 背景[backboard]: Memphis等一群蒟蒻出题中,花神凑过来秒题-- 描述[discribe]: 花花山峰峦起伏,峰顶常年被雪 ...

  2. bzoj3208: 花神的秒题计划Ⅰ

    3208: 花神的秒题计划Ⅰ Time Limit: 16 Sec  Memory Limit: 128 MBSubmit: 323  Solved: 211[Submit][Status] Desc ...

  3. BZOJ-3208|记忆化搜索-花神的秒题计划Ⅰ

    背景[backboard]: Memphis等一群蒟蒻出题中,花神凑过来秒题-- 描述[discribe]: 花花山峰峦起伏,峰顶常年被雪,Memphis打算帮花花山风景区的人员开发一个滑雪项目. 我 ...

  4. BZOJ3208:花神的秒题计划Ⅰ(记忆化搜索DP)

    Description 背景[backboard]: Memphis等一群蒟蒻出题中,花神凑过来秒题……   描述[discribe]: 花花山峰峦起伏,峰顶常年被雪,Memphis打算帮花花山风景区 ...

  5. bzoj3208:花神的秒题计划I

    思路:因为Q.S.B操作总和不超过100,因此怎么暴力怎么写....当然记忆化搜索还是要的 #include<cstdio> #include<iostream> #inclu ...

  6. 【记忆化搜索】bzoj3208 花神的秒题计划Ⅰ

    暴力 #include<cstdio> #include<cstring> #include<algorithm> using namespace std; #de ...

  7. 【bzoj3208】花神的秒题计划Ⅰ

    记忆化搜索 #include<algorithm> #include<iostream> #include<cstring> #include<cstdlib ...

  8. bzoj 前100题计划

    bzoj前100题计划 xz布置的巨大的坑.. 有空填题解... 1002 轮状病毒 用python手动matrixtree打表. #include<bits/stdc++.h> #def ...

  9. BZOJ第一页刷题计划

    BZOJ第一页刷题计划 已完成:67 / 90 [BZOJ1000]A+B Problem:A+B: [BZOJ1001][BeiJing2006]狼抓兔子:最小割: [BZOJ1002][FJOI2 ...

随机推荐

  1. 搭建NDK环境

    2014.07.14 搭建OK,但是目前只能手动编译c代码,具体不清楚.

  2. Linux - tomcat -jndi数据源配置

    Linux - tomcat -jndi数据源配置 tomcat/conf/context .xml 文件中修改如下 <Resource name="/jdbc/--" au ...

  3. UVa 357 - Let Me Count The Ways

    题目大意:也是硬币兑换问题,与147.674用同样的方法即可解决. #include <cstdio> #include <cstring> #define MAXN 3000 ...

  4. Javascript 查找元素

    DOM定义了多种查找元素的方法,除了我们常用的getElementById(),还有getElementsByTagName()和getElementsByName().使用这几种方法方法我们可以查找 ...

  5. 三 APPIUM Android自动化 测试初体验

    1.创建一个maven项目 成功新建工程: 编辑pom.xml,在<dependencies></dependencies>下添加appium相关依赖: <depende ...

  6. C# 程序集 和 反射

    .Net反射机制是在运行状态中,对于任意一个类,都能够知道这个类的所有属性和方法:对于任意一个对象,都能够调用它的任意一个方法和属性:这种动态获取的信息以及动态调用对象的方法的功能称为.Net的反射机 ...

  7. es6笔记3^_^object

    一.destructuring ES6允许按照一定模式,从数组和对象中提取值,对变量进行赋值,这被称为解构Destructuring. //es5 if(1){ let cat = 'ken'; le ...

  8. Bootstrap入门(四)表格

    Bootstrap入门(四)表格 <table>标签 首先,引入bootstrap的css文件,然后表格内容放在一个class为table的<table>标签中(class=& ...

  9. 利用apache的mod_rewrite做URL规则重写

    使用mod_rewrite做url重写,伪静态,做过很多次,这次用几个例子记下来,便于后面查用. 使用方法: 1.在conf目录的httpd.conf文件中找到: LoadModule rewrite ...

  10. Android 自定义Activity栈对Activity统一管理

    转载请注明出处:http://www.cnblogs.com/Joanna-Yan/p/6307239.html public class AppManager { private static St ...