Codeforces-475B Strongly Connected City
仅仅用推断最外层是不是回路 假设是 则每两个点之间连通
#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的更多相关文章
- codeforces B. Strongly Connected City(dfs水过)
题意:有横向和纵向的街道,每个街道只有一个方向,垂直的街道相交会产生一个节点,这样每个节点都有两个方向, 问是否每一个节点都可以由其他的节点到达.... 思路:规律没有想到,直接爆搜!每一个节点dfs ...
- cf475B Strongly Connected City
B. Strongly Connected City time limit per test 2 seconds memory limit per test 256 megabytes input s ...
- Codeforces 475 B Strongly Connected City【DFS】
题意:给出n行m列的十字路口,<代表从东向西,>从西向东,v从北向南,^从南向北,问在任意一个十字路口是否都能走到其他任意的十字路口 四个方向搜,搜完之后,判断每个点能够访问的点的数目是否 ...
- [CF475E]Strongly Connected City 2
题目大意:给一张$n(n\leqslant2000)$个点的无向图,给所有边定向,使定向之后存在最多的有序点对$(a,b)$满足从$a$能到$b$ 题解:先把边双缩点,因为这里面的点一定两两可达. 根 ...
- @codeforces - 913F@ Strongly Connected Tournament
目录 @description@ @solution@ @accepted code@ @details@ @description@ n 个选手参加了一场竞赛,这场竞赛的规则如下: 1.一开始,所有 ...
- 【CodeForces】913 F. Strongly Connected Tournament 概率和期望DP
[题目]F. Strongly Connected Tournament [题意]给定n个点(游戏者),每轮游戏进行下列操作: 1.每对游戏者i和j(i<j)进行一场游戏,有p的概率i赢j(反之 ...
- PTA Strongly Connected Components
Write a program to find the strongly connected components in a digraph. Format of functions: void St ...
- algorithm@ Strongly Connected Component
Strongly Connected Components A directed graph is strongly connected if there is a path between all ...
- Strongly connected(hdu4635(强连通分量))
/* http://acm.hdu.edu.cn/showproblem.php?pid=4635 Strongly connected Time Limit: 2000/1000 MS (Java/ ...
随机推荐
- 原始tab栏切换
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- rm: cannot remove `dir': Device or resource busy解决办法
使用df查看系统发现: [ops@bs038 cm-5.4.0]$ df -hFilesystem Size Used Avail Use% Mounted on/dev/sda3 1.1T 200G ...
- java+ajax实例
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding= ...
- 在开发JavaBean的过程中打开Tomcat的reloadable
这样可以方便调试,就不用每次修改JavaBean都要重启服务器了,但是要记得,项目deploy阶段的时候要关闭这个选项(考虑服务器的性能问题) 配置Tomcat的/conf/server.xml即可 ...
- 使用supervisor过程中的一个问题
我有一个php写的脚本需要常驻内存,于是使用supervisor进行管理,后来由于进程运行时间长了以后会出现假死的情况,所以就改成进程在无事可做的时候就退出,然后让supervisor再拉起来,起到重 ...
- 影梭Android版使用教程
影梭Android版使用教程 2015年5月13日 admin 影梭使用教程 下载影梭Android版客户端 安卓客户端下载:下载地址 安装并打开影梭 按下图说明设置服务器.远程端口.密码和加密 ...
- js中的extend
js中的extend 1. JS中substring与substr的区别 之前在项目中用到substring方法,因为C#中也有字符串的截取方法Substring方法,当时也没有多想就误以为 ...
- ios NSString format 保留小数点 float double
self.orderCost.text = [NSStringstringWithFormat:@"%.1f元",self.order.cost.floatValue]; %.1f ...
- Kafka消息模拟器
package clickstream import java.util.{Properties, Random, UUID} import kafka.producer.{KeyedMessage, ...
- Tomcat 添加为系统服务 开机自动启动
http://jingyan.baidu.com/article/a65957f4b12b8724e77f9b5a.html Tomcat是Apache 软件基金会(Apache Software F ...