CF298B Sail
题目描述
# 题意
从($s_x$,$s_y$)驶向($e_x$,$e_y$)给出时刻总数t,有四种风向东南西北($E$,$S$,$W$,$N$),每一时刻给出一种风向,$E$$-$>$x$坐标+1,$S$$-$>y坐标-1,$W$$-$>x坐标-1,$N$$-$>y坐标+1,可以选择随风移动也可以选择停留(但都会经过1个时刻)求到达终点所需要的最小时刻。
输入格式
第一行输入$t$,$s_x$,$s_y$,$e_x$,$e_y$。
第二行输入$t$个字符表示每一时刻的风向.
输出格式
若能达到输出一个整数表示最短时刻,
若不能达到则输出"-1"
说明/提示
In the first sample, they can stay at seconds $ 1 $ , $ 3 $ , and move at seconds $ 2 $ , $ 4 $ .
In the second sample, they cannot sail to the destination.