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

#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. 每日英语:Does Evolution Want Us To Be Unhappy?

    Samuel Johnson called it the vanity of human wishes, and Buddhists talk about the endless cycle of d ...

  2. Android AlarmManager的一些问题

    我开始的代码是这样写的 alarmManager.set(AlarmManager.RTC_WAKEUP, (5*1000), sender); 我的本意是设定五秒后启动闹钟 但是每次都是我设置完闹钟 ...

  3. Eclipse中设置文件编码

    如果你在使用某个editor进行开发的话,文件编码就由改editor解决即可 Eclipse中也有这个功能,帮你设置文件的编码,选择Edit->Set Encoding即可 注意,这个选项针对不 ...

  4. 可视化工具连接mysql报1862【mysql修改登录密码】

    1862是密码被修改了. 修改方法: 1.以root登录账户: 账户与密码都是root mysql -uroot -proot 2.修改密码 set password = password('1234 ...

  5. vim复制粘贴常用命令

    在Windows下我们习惯的操作,复制单个字符,复制单行多行,删除单行多行,在linux的vim中操作如下: G(shift+g+g):跳到文档尾 g+g:跳转到文档首 home键:光标移动到行首 e ...

  6. VBA学习笔记(5)--事件,记录每次操作改动

    说明(2017.3.24): 1. 记录sheet1里面的每次改动,和改动时间! 2. 不能记录大范围的删除.改动,会提示“类型不匹配” Private Sub Worksheet_Change(By ...

  7. Jackson2.1.4 序列化对象时对属性的过滤

    //对field(所有字段)进行过滤 //对get方法进行过滤 //对isBoolean这样的方法进行过滤 //里面的具体配置有 ANY,DEFAULT,NON_PRIVATE,NONE,PROTEC ...

  8. HDFS入门

    HDFS入门 欢迎关注我的个人博客:http://www.cnblogs.com/yjd_hycf_space 更多大数据以及编程相关的精彩文章 为什么我们需要HDFS 文件系统由三部分组成:与文件管 ...

  9. UVA 11019 Matrix Matcher 矩阵匹配器 AC自动机 二维文本串查找二维模式串

    链接:https://vjudge.net/problem/UVA-11019lrjP218 matrix matcher #include<bits/stdc++.h> using na ...

  10. iOS边练边学--简单的数据操作(增、删、改),左滑动删除和弹窗

    一.数据刷新的原则: 通过修改模型数据,来修改tableView的展示 先修改数据模型 在调用数据刷新方法 不要直接修改cell上面子控件的属性 二.增删改用到的方法: <1>重新绑定屏幕 ...