CF586D. Phillip and Trains】的更多相关文章

/* CF586D. Phillip and Trains http://codeforces.com/problemset/problem/586/D 搜索 */ #include<cstdio> #include<algorithm> #include<string.h> using namespace std; ; ][Nmax]; ][Nmax]; int n,k; int t,ans; int dfs(int step,int pos) { &&…
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 game called "Subway Roller". The protagonist of the game Philip is loca…
D. Phillip and Trains Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/586/problem/D Description The mobile application store has a new game called "Subway Roller". The protagonist of the game Philip is located in one en…
题目链接 Phillip and Trains 考虑相对位移. 每一轮人向右移动一格,再在竖直方向上移动0~1格,列车再向左移动两格. 这个过程相当于每一轮人向右移动一格,再在竖直方向上移动0~1格,然后人再向右移动两格. 然后就可以进行状态转移了. f[i][j]表示能否走到i行j列的位置.最后在终点处查找是否存在f[i][ed]为1即可. #include <bits/stdc++.h> using namespace std; #define rep(i,a,b) for(int i(a…
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 rectangular field consisting of three rows and n co…
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output 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 a…
http://codeforces.com/problemset/problem/586/D 题意:有一个3*n(n<100)的隧道.一个人在最左边,要走到最右边,每次他先向右移动一格,再上下移动一格.隧道里有车,每次人移动以后,车会向右移动两格,人与车轮流运动. 题解,将每次车的移动变成人往右移动两格,然后就能搜索了.dfs,用vis数组判掉已经移动到的格子(因为已经移动到的格子要么是不能走到底的,要么就可以走完).注意他只能移动到三的倍数的格子,所以读入map后要再后面加两列'.' #def…
原题连接:http://codeforces.com/contest/586/problem/D 题意: 就大家都玩过地铁奔跑这个游戏(我没玩过),然后给你个当前的地铁的状况,让你判断人是否能够出去. 题解: 就首先预处理一下每个点在哪些时刻会被车子占领,然后从右向左dp一下就好 代码: #include<iostream> #include<cstring> #include<string> #include<vector> #include<alg…
这道题是一道搜索题 但是 如果没有读懂或者 或者拐过弯 就很麻烦 最多26个火车 那么每一个周期 (人走一次 车走一次) 就要更改地图 的状态 而且操作复杂 容易超时 出错 利用相对运动 计周期为 人向上或向下或不动一步 + 向右三步 这样就变为走迷宫问题了 同样要注意 1.去重数组 或者 将以前访问过的点置为其他符号 避免重复访问 2.还有 因为 每次是三步三步的往右走 所以最后的边界可能不够 可以再扩充三列 #include <iostream> #include <stdio.h&…
A.Phillip and Trains CodeForces 586D 题意:过隧道,每次人可以先向前一格,然后向上或向下或不动,然后车都向左2格.问能否到达隧道终点. 题解:dp,一开始s所在列如果前方为'.'则dp[i]=1.r[i]代表上一次的dp[i]值. 如果该行当前可行,那么它就可以更新它上下两行(如果有),必须用r[i]去更新. 再判断每行在当前时间是否会发生撞车:看看位置 i+t*2,i+t*2+1,i+t*2+2 是否有车. #include <iostream> #inc…