当前位置:网站首页>The pta patching simple graph theory
The pta patching simple graph theory
2022-08-08 05:46:00 【a little yu】
Memoized search can avoid timeouts, and read questions well.
The picture below is taken from Sina Weibo of "British Joke Encyclopedia" - so no need to worry whether you encounter problems or not.

Bloggers call this kind of logical deduction "logically consistent", that all reasoning paths from a proposition lead to the same final proposition (just kidding, don'tThought this was a really logically self-consistent definition...).Now given a more complex logical reasoning diagram, this question asks you to check whether the reasoning from a given proposition to another is "logically self-consistent", and how many different reasoning paths exist.For example, in the figure above, from "Have you encountered a problem?" to "Then don't worry about it" is a "logically consistent" reasoning, with a total of 3 different reasoning paths.
input format:
The input first gives two positive integers N (1 The next M lines, each line gives the reasoning relationship between a pair of propositions, that is, the number of the two propositions The last line gives the numbers of the two propositions to be tested In one line first output how many different inference paths are there from The title guarantees that the output data does not exceed 109. Code length limit 16 KB Time limit 400 ms Memory Limit 64MB Code:S1 S2, indicating that it can be deduced from S1S1code>S2.The title guarantees that there is at most one inference relationship between any two propositions, and that any proposition cannot be self-evidence (that is, the proposition itself is derived from the proposition).A B.Output format:
A to B, then output Yes if the inference is "logical self-Contact", or No if not.Input Sample 1:
7 87 67 46 54 15 25 3twenty one3 17 1Output Sample 1:
3 YesInput Sample 2:
7 87 67 46 54 15 25 36 13 17 1Output Sample 2:
3 No#include
边栏推荐
猜你喜欢

棋盘染色问题

数字IC设计笔试题汇总(四):一些基础知识点

预处理笔记

Rust development - Struct usage example

基本工具-NETCAT(telnet-banner、传输文本信息)

数字IC设计中为什么要避免锁存器(Latches)

apifox使用文档之环境变量 / 全局变量 / 临时变量附apifox学习路线图
![Talk about the principle and implementation of Redis distributed lock [Ant Financial Services Three Sides]](/img/ed/dbaeab544066b5dbf19e71bee0f8c9.png)
Talk about the principle and implementation of Redis distributed lock [Ant Financial Services Three Sides]

分布式事务 :可靠消息最终一致性方案

APISIX Ingress v1.5-rc1 released
随机推荐
Week 9 10 Neural Networks
28.异常检测
KDD'22 Recommendation System Papers (24 Research & 36 Application Papers)
uniapp H5 签名横版生成图片
补坑 模拟散列表
Session 和 Cookie 使用
主脑提示( Master-Mind Hints )
查询时间内用户分布的sql语句
卷积神经网络的基本操作,卷积神经网络卷积计算
Talk about the principle and implementation of Redis distributed lock [Ant Financial Services Three Sides]
为什么互联网大厂一边疯狂裁员,一边不停招聘?
[u-boot] Analysis of the driver model of u-boot
神经网络解决哪些问题,神经网络结果不稳定
TCP/IP基本实现
Week 9 10 Neural Networks
字符串哈希 哈希值
整数分块例题
浅学软件逆向笔记(1)
String title parsing
C语言力扣第58题之最后一个单词的长度。从后往前遍历