Codeforces 586D Phillip and Trains dfs —— Round #325 (Div. 2)

DP-600认证备考指南:如何用微软官方资源7天速通Fabric工程师考试 本文提供了一份高效的DP-600认证备考指南,帮助考生在7天内利用微软官方资源快速掌握Microsoft Fabric核心技能。从评估基础水平到制定详细学习计划,再到核心知识领域深度解析和考试策略,全面覆盖备考要点,助力考生顺利通过Fabric工程师认证考试。 阅读详情

原题见CF 586D

给一个3*n的地图,人s从最左边一列的某个位置出发,每次先向右走一步,再选择上、下、不动。接着连续的字母表示火车,均向左走两步。如此循环,人和火车不能相撞。问人是否能走到地图的最右边。

人相对火车的水平距离其实是每次走了三步,火车可以不用动。
只要人走到当前地图的最右边,之后就不会再出现火车,输出YES即可。
所以先扩展一下地图,让之后n+10列均为’.’,然后dfs跑完即可。

搜索过的点要做个已经搜索的标记,否则会T.
昨天改完以后最后15秒的时候交的,超刺激!

附code

/*--------------------------------------------
 * File Name: CF 586 D
 * Author: Danliwoo
 * Mail: Danliwoo@outlook.com
 * Created Time: 2015-10-12 17:44:58
--------------------------------------------*/

#include <cstdio>
#include <iostream>
#include <cstring>
#include <queue>
#include <algorithm>
#include <cmath>
using namespace std;
int n, k, ans;
char str[3][150];
int mp[3][150];
int dfs(int x, int y)
{
    mp[x][y] = 1;
    if(y >= n-1)
        return 1;
    if(str[x][y+1] != '.')      
        return 0;
    for(int i = 0;i < 3;i++)
    {
        if(abs(i-x) > 1) continue;
        int v = 0;
        for(int j = 1;j < 4;j++)
        {
            if(str[i][y+j] != '.')
            {
                v = 1;
                break;
            }
        }
        if(v) continue;
        if(!mp[i][y+3])
        {
            int v = dfs(i, y+3);
            if(v) return 1;
        }
    }
    return 0;
}
int main()
{
    int T;
    while(~scanf("%d", &T))
    {
        while(T--)
        {
            memset(mp, 0, sizeof(mp));
            ans = 0;
            scanf("%d%d", &n, &k);
            for(int i = 0;i < 3;i++)
            {
                scanf("%s", str[i]);
                for(int j = 0;j < 10;j++)
                    str[i][n+j] = '.';
                str[i][n+10] = '\0';    
            }
            for(int i = 0;i < 3;i++)
            {
                if(str[i][0] == 's')
                {
                    int ans = dfs(i, 0);
                    if(ans)
                        printf("YES\n");
                    else
                        printf("NO\n");
                    break;
                }
            }
        }
    }
    return 0;
}
网易数智CoreAgent实战:5步教你打造企业级AI数字员工(附避坑指南) 本文以网易数智CoreAgent智能体协作中枢为核心,提供了一份企业级AI数字员工的实战部署指南。文章详细拆解了从环境准备、智能体配置、业务集成、安全合规到效果评估的五个关键步骤,并分享了部署过程中的常见“避坑”经验,旨在帮助企业技术团队高效、安全地将AI智能体落地于实际业务场景,解决AI落地难题。 阅读详情

相关推荐

GD32F303调试小记(一)之USART(接收中断、接收空闲中断+DMA、发送DMA)

前言 之前写了GD32F103调试小记(二)之USART(接收中断、接收空闲中断+DMA、发送DMA)一文。这次我们来看看GD32F303的USART是如何配置的,结合这两篇文章,相信大家GD32的USART配置流程会十分熟悉。 DMA 能大大减轻CPU负荷的东西,建议场景合适的情况下,都去用DMA功能。 USART 一种串行通信协议, ...

欢喜6666的博客 3万+

Codeforces 1260总结

A. Heating Several days ago you bought a new house and now you are planning to start a renovation. Since winters in your region can be very cold you need to decide how to heat rooms in your house. Your house has n rooms. In the i-th room you can install at

weixin_46434074的博客 545

别再怕ADRC调参了!手把手教你用MATLAB/Simulink搞定TD、ESO、NLSEF(附完整参数表)

本文详细解析了ADRC(自抗扰控制)的调参方法,通过MATLAB/Simulink实战演示,帮助工程师快速掌握TD、ESO和NLSEF模块的参数整定技巧。文章提供了完整的参数表和调参指南,解决ADRC调参难题,提升控制系统的鲁棒性和性能。

weixin_30252709的博客 180

【Educational Codeforces Round 33 C】 Rumor

【链接】 我是链接,点我呀:) 【题意】 在这里输入题意 【题解】 显然最后会形成多个集合,每个集合里面的人能够可以互相到达。 则维护并查集的时候,顺便维护一下每个集合里面的最小值就好。 最后答案就为∑min{每个集合} 【代码】 /* 1.Shoud it use long long ? 2.Have you ever test several sa...

134

Windows BITS服务:后台智能文件传输技术详解

后台文件传输技术是现代IT基础设施中的关键组件,Windows BITS(Background Intelligent Transfer Service)作为微软原生解决方案,通过队列管理和智能调度实现高效数据传输。其核心技术原理包括分块传输、断点续传和带宽自适应,能够根据网络状况动态调整传输速率(默认占用空闲带宽的80%)。在工程实践中,BITS特别适用于企业软件分发和自动化数据采集场景,通过PowerShell命令即可实现高优先级传输和代理配置。相比传统FTP方案,BITS在跨国文件传输中将失败率从30

weixin_42116058的博客 304

汇川Easy 301 和MCGS进行Modbus RTU通讯(485)浮点数读取和写入

4DF0001对应寄存器D0,4DF0003对应寄存器D2。注意:要选com2口,com1口是232通讯。

qq_61916672的博客 2924

Codeforces 835C

C. Star sky time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output The Cartesian coordinate system is set in the s

Oops的博客 362

STM32_WS2811驱动

STM32的WS2811驱动

健身房 2846

[fw]Understanding a Kernel Oops!

An “Oops” is what the kernel throws at us when it finds something faulty, or an exception, in the kernel code. It’s somewhat like the segfaults of user-space. An Oops dumps its message on the ...

weixin_30384217的博客 196

保姆级教程:用TI IWR6843雷达板跑通3D人体追踪demo(附CCS/UniFlash避坑指南)

本文提供了一份详尽的TI IWR6843毫米波雷达开发板3D人体追踪demo实现指南,涵盖开发环境搭建、工程导入编译、固件烧录及可视化工具配置全流程。特别针对CCS和UniFlash使用中的常见问题给出解决方案,帮助开发者快速掌握3D People Tracking技术应用。

weixin_29159441的博客 521

基于深度学习的目标检测在 Android 端的优化实现:YOLO Mobile × NPU 加速实战教程

随着国产手机芯片日益强大,终端侧的目标检测任务已经具备实用性基础。本文围绕实际工程场景,详细讲解如何在 Android 应用中部署轻量级目标检测模型(如 YOLO Mobile、EfficientDet Lite),并结合国产手机 NPU 能力,实现高性能、低延迟、实时目标检测系统。文章将涵盖从模型选择、结构优化、量化转换到 Android 上推理加速、UI 实时渲染的全链路工程路径,强调每一环节的真实可复现性与部署细节,适合 AI 工程师、移动开发者及企业级应用落地团队参考使用。

努力分享一些人工智能、计算机视觉、影像等相关的知识干货! 1414

【CodeForces 621C】Wet Shark and Flowers

题 There arensharks who grow flowers for Wet Shark. They are all sitting around the table, such that sharksiandi + 1are neighbours for allifrom1ton - 1. Sharksnand1are neighbours ...

dingguayi7025的博客 253

使用Google Earth Engine下载JRC全球水体数据

通过Google Earth Engine平台和提供的源代码,研究人员和水资源管理者可以方便地获取和利用这一重要的水资源监测数据集,从而开展相关的研究和决策支持工作。要使用Google Earth Engine下载JRC全球水体数据,首先需要在Google Earth Engine平台上进行注册和登录。JRC全球水体数据是由欧洲联合研究中心开发的高分辨率全球水体分类数据集,覆盖了整个地球的陆地和水域。下载完成后,你可以使用各种遥感数据处理软件来打开和分析这些数据,以满足不同的研究和应用需求。

LrlDebug的博客 1163

CodeForces - 978D·Almost Arithmetic Progression

题目 题目大意 分析 代码 题目 传送门 题目大意 给你一个长度为nnn的数列(1≤n≤1000001≤n≤1000001\leq n\leq 100000),对任意元素你可以最多进行一次操作:将其加111或减111,问将次数列变成等差数列的最小代价(当n≤2n≤2n\leq 2时,数列一定为等差数列)。 分析 比赛时脑袋抽,硬是想从数列相邻两数的差入手,结果凉...

ixRic 968

全球国家地区城市数据

MySQL全球国家地区城市数据报。。。。。。。。。。。。

IDEA的使用指南

IDEA基于java的使用手册,可以最快速的上手,在使用中不断的丰富自己的使用技巧.

.NET Interview Questions And Answers

· Differences1. Difference between Classic ASP and ASP.Net?Answer: § ASP is Interpreted language based on scripting languages like Jscript or VBScript. § ASP has Mixed HTML and coding logic.

ξσ Dicky's Blog σξ 3617

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

horizon 无法访问,This site can’t be reached

环境: centos7.6 minimal openstack master 问题描述: 在用devstack搭建环境后,无法访问horizon的页面,使用 systemctl status devstack@* 查看服务,发现所有的服务都是正常的。 解决过程: 一开始以为是防火墙的缘故(过去有遇到这种情况),通过 systemctl status firewalld 发现firewalld确...

albertjone的博客 1万+

ET2012新版免狗免安装绿色软件

ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,

CodeForces 586D Phillip and Trains (dfs)

D. Phillip and Trainstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe mobile application store has a new game called "Subway Roller".The protago...

Mizersy的博客 350

CodeForces - 586D A - Phillip and Trains bfs

The mobile application store has a new game called "Subway Roller". The protagonist of the game Philip is located in one end of the tunnel and wants to get out of the other one. The tunnel is a recta

Marcus-Bao的个人主页 628

CodeForces - 586D Phillip and Trains (BFS || DP)

The mobile application store has a new game called "Subway Roller".The protagonist of the game Philip is located in one end of the tunnel and wants to get out of the other one. The tunnel is a rectang...

←_← 388

Codeforces Round #325 (Div. 2)D. Phillip and Trains BFS

D. Phillip and Trains The mobile application store has a new game called "Subway Roller". The protagonist of the game Philip is located in o...

weixin_30345055的博客 180

Codeforces586D. Phillip and Trains(DFS)

D. Phillip and Trains time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output The mobile application store has a new

KeyboardPianist的博客 684

CodeForces 586D Phillip and Trains (基础搜索 -- DFS)

题目链接:点击打开链接 D. Phillip and Trains time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output The mobile application store has a

OUC_Turing_Neumann的博客 402

Codeforces 586D Phillip and Trains 题解

Codeforces 586D题解

DarkoDu的博客 442

Mobile Application Store

总结一下 Exsiting Moible Application Store [list] [*]http://store.apple.com/us [*]http://www.android.com/market/ [*]RIM Application Center. [*]http://www.orangepartner.com/ [*]http://store.ovi.co...

myrepos的专栏 214

【Codeforces Round #325 (Div. 2)】D. Phillip and Trains

Codeforces Round #325 (Div. 2) 题目D. Phillip and Trains

Johann的博客 859

Codeforces Round #325 (Div. 2)-D. Phillip and Trains

原题链接 D. Phillip and Trains time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output The mobile application store has a new game called “Subway Roll

HowieMen的博客 879
上一篇: Codeforces 586C Gennady the Dentist 模拟
下一篇: Codeforces 589D Boulevard 线段相交
Danliwoo
博客等级 码龄11年 133粉丝 86原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值