1637: Yet Satisfiability Again! Time Limit: 5 Sec Memory Limit: 128 MB Description Alice recently started to work for a hardware design company and as a part of her job, she needs to identify defects in fabricated ntegrated circuits. An approach for…
Sightseeing tour Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 6986 Accepted: 2901 Description The city executive board in Lund wants to construct a sightseeing tour by bus in Lund, so that tourists can see every corner of the beauti…
嗯,这是我上一篇文章说的那本宝典的第二题,我只想说,真TM是本宝典……做的我又痛苦又激动……(我感觉ACM的日常尽在这张表情中了) 题目链接:http://poj.org/problem?id=1637 Time Limit: 1000MS Memory Limit: 10000K Description The city executive board in Lund wants to construct a sightseeing tour by bus in Lund, so that t…
并查集的经典题目: CSUOJ 1601: War Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 247 Solved: 70[Submit][Status][Web Board] Description AME decided to destroy CH’s country. In CH’ country, There are N villages, which are numbered from 1 to N. We say two vill…
题目:http://poj.org/problem?id=1637 建图很妙: 先给无向边随便定向,这样会有一些点的入度不等于出度: 如果入度和出度的差值不是偶数,也就是说这个点的总度数是奇数,那么一定无解: 随便定向后,如果定向 x -> y,那么从 y 向 x 连一条容量为1的边,将来选了这条边,表示重新定向成 y -> x 了: 考虑如果选了这条边,那么 x 的出度-1,入度+1,变化量是2: 所以对于每个点,如果入度>出度,从源点向它连容量为 (入度-出度)/2 的边,因为刚才改…
题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=1637 题意: Farmer John 决定给他的奶牛们照一张合影,他让 N (1 ≤ N ≤ 50,000) 头奶牛站成一条直线,每头牛都有它的坐标x(0 <= x <= 10^9)和种族(0或1). 他只给一部分牛照相,并且这一组牛的阵容必须是“平衡的”. 平衡的阵容,指的是在一组牛中,种族0和种族1的牛的数量相等. 区间的大小为区间内最右边的牛的坐标减去最做边的牛的坐标. 请算出最…
Given an array equations of strings that represent relationships between variables, each string equations[i] has length 4 and takes one of two different forms: "a==b" or "a!=b". Here, a and b are lowercase letters (not necessarily dif…
Sightseeing tour Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 9276 Accepted: 3924 Description The city executive board in Lund wants to construct a sightseeing tour by bus in Lund, so that tourists can see every corner of the beauti…
http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1119 1119: Collecting Coins Time Limit: 3 Sec Memory Limit: 128 MBSubmit: 144 Solved: 35[Submit][Status][Web Board] Description In a maze of r rows and c columns, your task is to collect as many coin…
http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1116 1116: Kingdoms Time Limit: 3 Sec Memory Limit: 64 MBSubmit: 293 Solved: 82[Submit][Status][Web Board] Description A kingdom has n cities numbered 1 to n, and some bidirectional roads connecting…