仅仅用推断最外层是不是回路  假设是   则每两个点之间连通

#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#define INF 200000
using namespace std; int main()
{
char a[3][22];
int n,m,i,j;
scanf("%d%d",&n,&m);
getchar();
for(i=1;i<=2;i++)
scanf("%s",a[i]);
j=1;
if(a[1][0]=='<'&&a[2][0]=='^') j=0;
if(a[1][0]=='>'&&a[2][m-1]=='^') j=0;
if(a[1][n-1]=='<'&&a[2][0]=='v') j=0;
if(a[1][n-1]=='>'&&a[2][m-1]=='v') j=0; if(j) printf("YES\n");
else printf("NO\n");
return 0;
}

Codeforces-475B Strongly Connected City的更多相关文章

  1. codeforces B. Strongly Connected City(dfs水过)

    题意:有横向和纵向的街道,每个街道只有一个方向,垂直的街道相交会产生一个节点,这样每个节点都有两个方向, 问是否每一个节点都可以由其他的节点到达.... 思路:规律没有想到,直接爆搜!每一个节点dfs ...

  2. cf475B Strongly Connected City

    B. Strongly Connected City time limit per test 2 seconds memory limit per test 256 megabytes input s ...

  3. Codeforces 475 B Strongly Connected City【DFS】

    题意:给出n行m列的十字路口,<代表从东向西,>从西向东,v从北向南,^从南向北,问在任意一个十字路口是否都能走到其他任意的十字路口 四个方向搜,搜完之后,判断每个点能够访问的点的数目是否 ...

  4. [CF475E]Strongly Connected City 2

    题目大意:给一张$n(n\leqslant2000)$个点的无向图,给所有边定向,使定向之后存在最多的有序点对$(a,b)$满足从$a$能到$b$ 题解:先把边双缩点,因为这里面的点一定两两可达. 根 ...

  5. @codeforces - 913F@ Strongly Connected Tournament

    目录 @description@ @solution@ @accepted code@ @details@ @description@ n 个选手参加了一场竞赛,这场竞赛的规则如下: 1.一开始,所有 ...

  6. 【CodeForces】913 F. Strongly Connected Tournament 概率和期望DP

    [题目]F. Strongly Connected Tournament [题意]给定n个点(游戏者),每轮游戏进行下列操作: 1.每对游戏者i和j(i<j)进行一场游戏,有p的概率i赢j(反之 ...

  7. PTA Strongly Connected Components

    Write a program to find the strongly connected components in a digraph. Format of functions: void St ...

  8. algorithm@ Strongly Connected Component

    Strongly Connected Components A directed graph is strongly connected if there is a path between all ...

  9. Strongly connected(hdu4635(强连通分量))

    /* http://acm.hdu.edu.cn/showproblem.php?pid=4635 Strongly connected Time Limit: 2000/1000 MS (Java/ ...

随机推荐

  1. 利用ForgeryPy生成虚拟数据

    在程序研发过程中,我们往往需要大量的虚拟实验数据.Python中有多个包可以用于生成虚拟数据,其中功能较为完善的是ForgeryPy. 1 安装 采用pip进行安装: pip install Forg ...

  2. 去除img、video之间默认间隔的几种方法

    img,video{ /*第1种方式*/ border: ; vertical-align: bottom; /*第2种方式*/ outline-width:0px; vertical-align:t ...

  3. config对象

    在js中经常定义一个config对象来保存当前对象里面的一些临时变量:定义这个变量可以被对象中所有的属性访问到,可以避免重复,减少内存占用,统一管理: 如: <script> functi ...

  4. appium安卓自动化常见问题处理

    appium安卓自动化常见问题处理 1.seesionnotcreatedexception 遇到这个首先确定下jdk需要1.7以上 然后还要确定appium是启动状态,可以cmd重启下appium ...

  5. MyEclipse9.0激活步骤

    MyEclipse 9.0的激活机制 1.破解公钥(确保MyEclipse没有开启,否则失败!)   解压破解包中的myeclipse9_keygen_activator.zip,复制publicKe ...

  6. Pro mvvm读书笔记mvvm中的VM

    一.构建ViewModels 设计模式的其中一个目标就是抽象构造一个给出指定类型的对象或者实现指定类型的接口的过程.需要把类给客户端,让客户端去使用,但是要隐藏类是具体的实现细节. 1.1The Ap ...

  7. SpringMVC之学习(0)

    Spring MVC 是一个模型 - 视图 - 控制器(MVC)的Web框架建立在中央前端控制器servlet(DispatcherServlet),它负责发送每个请求到合适的处理程序,使用视图来最终 ...

  8. 百度分享vue版-vshare

    vshare 基于百度分享开发的支持VUE2.X的分享插件,为您带来更多的流量!提供多种风格按钮,代码加载更快,引入社会化流量,提升网页抓取速度等优点.github地址:https://github. ...

  9. CKFinder 弹出窗口操作并设置回调函数

    CKFinder 弹出窗口操作并设置回调函数 官方例子参考CKFinderJava-2.4.1/ckfinder/_samples/popup.html 写一个与EXT集成的小例子 Ext.defin ...

  10. ExtJs Ext.form.field.TextArea+Ckeditor 扩展富文本编辑器

    Ext.define("MyApp.base.BaseTextArea", { extend: "Ext.form.field.TextArea", xtype ...