这就是一道滑雪嘛= =

所有操作都爆力,求路径就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. ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'mysql'

    提示:ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'mysql'.前两天也出现过这个问题,网上找了一个比 ...

  2. NSString总结

    [from]http://www.jianshu.com/p/7994b0ad6b88 问题:NSString到底是不是字符串? NSString 是 OC中专门处理字符串的对象!提供了转换大小写,拼 ...

  3. Apache Bench安装与使用

    一.Apache Bench简介 ApacheBench 是 Apache 服务器自带的一个web压力测试工具,简称ab.ab又是一个命令行工具,对发起负载的本机要求很低,根据ab命令可以创建很多的并 ...

  4. listview 去掉header和footer中的分割线

    在listView中加上android:headerDividersEnabled="false" android:footerDividersEnabled="fals ...

  5. p4factory 解决“g++: internal compiler error: Killed (program cc1plus)” make error问题

    参考:解决: g++: internal compiler error: Killed (program cc1plus) 在安装p4factory的时候,执行: ./install_deps.sh ...

  6. Python科学计算之Pandas

    Reference: http://mp.weixin.qq.com/s?src=3&timestamp=1474979163&ver=1&signature=wnZn1UtW ...

  7. 2781: [JSOI2007]文本生成器

    2781: [JSOI2007]文本生成器 Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 8  Solved: 4[Submit][Status][We ...

  8. 解压文件--linux

    linux下不同的文件格式用不同的命令解压. 对于tar.gz文件,用以下命令. .tar.gz 和 .tgz解压:tar zxvf FileName.tar.gz压缩:tar zcvf FileNa ...

  9. HDU-4861-Couple doubi(数学题,难懂!难懂!)

    题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=4861 这个题只能说没弄懂,感觉很难,看博客也看不懂,只能,多看几次,看能不能有所突破了. 代码的话只有 ...

  10. Refused to set unsafe header "Connection"

    参考 http://stackoverflow.com/questions/7210507/ajax-post-error-refused-to-set-unsafe-header-connectio ...