ACM: 差分约束 图论题 poj 2983 sp…
来源:互联网 发布:麻瓜编程 爬虫 编辑:程序博客网 时间:2024/05/18 11:28
Description
The galaxy war between theEmpire Draco and the Commonwealth of Zibu broke out 3 years ago.Draco established a line of defense called Grot. Grot is a straightline with N defense stations. Because of the cooperation ofthe stations, Zibu’s Marine Glory cannot march any further but stayoutside the line.
A mystery Information Group X benefits form selling informationto both sides of the war. Today you the administrator of Zibu’sIntelligence Department got a piece of information about Grot’sdefense stations’ arrangement from Information Group X. Your taskis to determine whether the information is reliable.
The information consists of M tips. Each tip is eitherprecise or vague.
Precise tip is in the form of P A B X
, meansdefense station A is X light-years north of defensestation B.
Vague tip is in the form of V A B
, means defensestation A is in the north of defense station B, atleast 1 light-year, but the precise distance is unknown.
Input
There are several test casesin the input. Each test case starts with two integers N (0< N ≤ 1000) and M (1 ≤ M ≤100000).The next M line each describe a tip, either inprecise form or vague form.
Output
Output one line for eachtest case in the input. Output “Reliable” if It is possible toarrange N defense stations satisfying all the M tips,otherwise output “Unreliable”.
Sample Input
3 4
P 1 2 1
P 2 3 1
V 1 3
P 1 3 1
5 5
V 1 2
V 2 3
V 3 4
V 4 5
V 3 5
Sample Output
Unreliable
Reliable
题意:
解题思路:
代码:
#include <cstdio>
#include <iostream>
#include <cstring>
#include <queue>
using namespace std;
#define MAX 300005
const int INF = (1<<30);
struct node
{
};
int n, m;
int first[MAX];
node edges[MAX];
int num;
void read_graph()
{
}
bool bellman_ford()
{
}
int main()
{
}
- ACM: 差分约束 图论题 poj 2983 sp…
- ACM: 图论题 poj 1201 差分约束
- ACM: 图论题 poj 1275 差分约束题
- ACM: spfa求解 图论题 (对差分约束…
- ACM: 图论题 poj 2240 (floyd + ST…
- ACM: 图论题 poj 3…
- ACM: 图论题 poj 1…
- ACM: 图论题 poj 1…
- ACM: 匈牙利算法 图论题 poj 3041 …
- ACM: 有向欧拉图 图论题 poj 1386 …
- ACM: polay定理 数论题 poj 1286 …
- poj 1364 King 差分约束
- poj 1201 Intervals (差分约束)
- poj 1364 King (差分约束)
- ACM: 图论题 poj 2253 (poj上的dou…
- ACM: 图论题 poj 1135
- poj 2983 中等的差分约束
- poj 3159 差分约束+最短…
- ACM: spfa求解 图论题 (对差分约束…
- ZOJ的轻松ACMER语录.. 狗一样的学…
- ACM: 二分法 数论题 poj 1905
- 数据
- ACM: 二分图最大匹配 hdu 2063
- ACM: 差分约束 图论题 poj 2983 sp…
- ACM: 最大流 图论题 poj 1797
- 图论: 最大流
- 图论: 最小费用最大流
- ACM: spfa+dfs 图论题 poj 2679
- ACM: 简单最小生成树 图论题 poj 1…
- ACM: 序列中找最小逆序对 杂题 TOJ…
- ACM: 数论题 toj 1721
- ACM:最大子树 动态规划题 toj2676