此题未通过 [ 老帅哥 ] 认证。

ZJ一下:

T1,明显是二分答案+$dij/SPFA$

T2,没看懂题。

T3,打了一个$\Theta(N^2)$暴力。

事实上……

T1,T2死了。

T1中

每次可以向上下左右四个方向走一格,走一格用时1 秒。

你有一个机器,使得每次在上下移动一步时,用时为k 秒。

你确定向上下不可以走么(一定要用机器???)

明明可以向上下左右四个方向走一格,走一格用时1

不管了,语文问题。

最后在作者××巨佬的自动防AK系统的作用下。

47
Miemeng 0

02:58:59
0

02:58:59
30

02:59:00
30

02:59:00

我祝福你,作者

%%%ZZD

nmsl

题解:

T1

一大句话题意:

有一个网格图,有格子不能走,向上下走需要$k$秒,向左右走需要$1$秒,问从$(x1,y1)$到$(x2,y2)$的最短时间为$s$时$k$的值。

#include <iostream>
#include <cstring>
#include <cstdio>
#include <queue>
#define LF double
#define N 111 using namespace std; const LF eps=1e-5;
int mp[N][N];
int lines,cols;
int stx,sty,fix,fiy;
LF targ,dis[N][N];
bool is_v[N][N];
struct POINT{
int x,y;
double dis;
POINT(){}
POINT(int a,int b,double c):x(a),y(b),dis(c){}
friend bool operator > (const POINT &a,const POINT &b){
return a.dis>b.dis;
}
};
priority_queue<POINT,vector<POINT>,greater<POINT> >q;
inline bool inmp(int x,int y){
return x>=1&&x<=lines&&y>=1&&y<=cols&&mp[x][y]==0;
}
LF check(LF ud){
memset(is_v,0,sizeof is_v);
for(int i=1;i<=lines;i++)
for(int j=1;j<=cols;j++)
dis[i][j]=1e10;
dis[stx][sty]=0;
q.push(POINT(stx,sty,0.0));
while(!q.empty()){
int fx=q.top().x,fy=q.top().y;
// cout<<fx<<" "<<fy<<" "<<mp[fx][fy]<<" "<<dis[fx][fy]<<endl;
q.pop();
if(is_v[fx][fy])continue;
is_v[fx][fy]=1;
if(inmp(fx+1,fy)&&dis[fx+1][fy]>dis[fx][fy]+ud){//puts("A");
dis[fx+1][fy]=dis[fx][fy]+ud;
q.push(POINT(fx+1,fy,dis[fx+1][fy]));
}
if(inmp(fx-1,fy)&&dis[fx-1][fy]>dis[fx][fy]+ud){//puts("B");
dis[fx-1][fy]=dis[fx][fy]+ud;
q.push(POINT(fx-1,fy,dis[fx-1][fy]));
}
if(inmp(fx,fy+1)&&dis[fx][fy+1]>dis[fx][fy]+1.0){//puts("C");
dis[fx][fy+1]=dis[fx][fy]+1.0;
q.push(POINT(fx,fy+1,dis[fx][fy+1]));
}
if(inmp(fx,fy-1)&&dis[fx][fy-1]>dis[fx][fy]+1.0){//puts("D");
dis[fx][fy-1]=dis[fx][fy]+1.0;
q.push(POINT(fx,fy-1,dis[fx][fy-1]));
}
}
return dis[fix][fiy];
}
int main(){
// freopen("1.in" ,"r",stdin);
// freopen("maze.in" ,"r",stdin);\
freopen("maze.out","w",stdout);
scanf("%d%d%d%d%d%d",&lines,&cols,&stx,&sty,&fix,&fiy);
for(int i=1;i<=lines;i++)
for(int j=1;j<=cols;j++)
scanf("%d",&mp[i][j]);
scanf("%lf",&targ);
LF l=0,r=lines*cols;
while(r-l>eps){
LF mid=(l+r)/2;
// cout<<l<<" "<<r<<" "<<check(mid)<<endl;
if(check(mid)>targ) r=mid;
else l=mid;
}
printf("%.3lf\n",l);
// cout<<clock()<<endl;
}

T2

T3

19-10-25-G-悲伤的更多相关文章

  1. 程序员的 Ubuntu 19.10 配置与优化指南

    原文地址:程序员的 Ubuntu 19.10 配置与优化指南 0x00 环境 CPU: Intel Core i9-9900k GPU: GeForce RTX 2070 SUPER RAM: DDR ...

  2. 背水一战 Windows 10 (25) - MVVM: 通过 x:Bind 实现 MVVM(不用 Command)

    [源码下载] 背水一战 Windows 10 (25) - MVVM: 通过 x:Bind 实现 MVVM(不用 Command) 作者:webabcd 介绍背水一战 Windows 10 之 MVV ...

  3. /proc/interrupts 统计2.6.38.8与3.10.25差异

    eth4进,eth5出 linux-3.10.25 67:          2          3          2          3   PCI-MSI-edge     eth468: ...

  4. CentOS安装NodeJS v0.10.25 + Express

    安装必需组件 yum -y install gcc make gcc-c++ openssl-devel wget cd ~wget http://nodejs.org/dist/v0.10.25/n ...

  5. 10.25 正睿停课训练 Day9

    目录 2018.10.25 正睿停课训练 Day9 A 数独(思路 DP) B 红绿灯(最短路Dijkstra) C 轰炸(计算几何 圆并) 考试代码 B C 2018.10.25 正睿停课训练 Da ...

  6. Ubuntu 19.10 发布 | 云原生生态周报 Vol. 24

    作者 | 木苏.进超.冬岛.元毅.心水.衷源 业界要闻 1.云原生编程语言 Pulumi 1.0 pulumi ,一款中立的开源云开发平台,Pulumi 支持多语言.混合云环境.完全可扩展.初期支持 ...

  7. [Linux] 在 Ubuntu 19.10 上开启 SSH 服务并允许远程登录

    在 Ubuntu 19.10 上安装 SSH,并开启服务 0.检查并确认系统当前是否已安装SSH: sudo ps -e | grep ssh 如果只有 ssh-agent 说明 ssh-server ...

  8. [Linux] 树莓派 4B 安装 Ubuntu 19.10 (Eoan Ermine) IOT 版

    硬件:Raspberry Pi 4B系统:Ubuntu 19.10 (Eoan Ermine) for IOT官网:https://ubuntu.com/download/iot/raspberry- ...

  9. Java习题10.25

    Java习题10.25 1. 实际上这道题考查的是两同两小一大原则: 方法名相同,参数类型相同 子类返回类型小于等于父类方法返回类型, 子类抛出异常小于等于父类方法抛出异常, 子类访问权限大于等于父类 ...

  10. Ubuntu 19.10 安装 jupyter

    安装pip3 ubuntu 19.10 已经没有python了,取代的是python3. 执行sudo apt install python3-pip安装pip3 安装jupyter 执行sudo p ...

随机推荐

  1. CF1086F Forest Fires

    CF1086F Forest Fires 有点意思的题目 直接统计每个格子的val是非常难办的.很难知道每秒新出来多少个格子 设$F[i]$表示,前i时刻覆盖的格子的数量 则,$ans=\sum_{i ...

  2. (转)Wireshark "The NPF driver isn’t running…"(

    转:http://blog.sina.com.cn/s/blog_4bfd07180100e3ar.html 前几天重装系统,装上了windows7 RC系统.昨天开始尝试装上了wireshark 这 ...

  3. (转)Android中RelativeLayout各个属性的含义

    转:http://blog.csdn.net/softkexin/article/details/5933589 android:layout_above="@id/xxx"  - ...

  4. 编译报错 :The method list(String, Object[]) is ambiguous for the type BaseHibernateDao<M,PK>

    原因:eclipse 的个bug,具体见http://stackoverflow.com/questions/10852923/method-is-ambiguous-for-the-type-but ...

  5. JS 变量的数据类型转换

    变量的类型转换,一般情况是JS自动转换的,但也有些时候需要手动转换. 1.其它类型转成布尔型 函数和方法的区别 Boolean(a)  //函数是可以独立使用的 document.write(a)   ...

  6. Web中常见的绕过和技巧

    SQL注入 十六进制绕过引号 slect table_name from information_schema.table where table_schema="sqli"; s ...

  7. Java 10的10个新特性,将彻底改变你写代码的方式!

    Java 9才发布几个月,很多玩意都没整明白,现在Java 10又快要来了.. 这时候我真尼玛想说:线上用的JDK 7 甚至JDK 6,JDK 8 还没用熟,JDK 9 才发布不久不知道啥玩意,JDK ...

  8. WPF基础之Grid面板

    一.显示 Grid的线条,设置ShowGridLiens="True".

  9. 在使用python语言的open函数时,提示错误OSError: [Errno 22] Invalid argument: ‘文件路径’

    如题,在使用python语言的open函数时,提示错误OSError: [Errno 22] Invalid argument: '文件路径',在查阅了大量资料后也得到了一些解决方案,但是这些解决方案 ...

  10. ASP.NET WEB API 特性路由

    一.什么是特性路由? 特性路由是指将RouteAttribute或自定义继承自RouteAttribute的特性类标记在控制器或ACTION上,同时指定路由Url字符串,从而实现路由映射,相比之前的通 ...