文件名称:Colored-Sticks
介绍说明--下载内容均来自于网络,请自行研究使用
北京大学ACM/ICPC竞赛队
2009 PKU ACM/ICPC Trainning 14
Colored Sticks
F:Colored Sticks
时间限制:
5000ms
内存限制:
65536kB
描述
You are given a bunch of wooden sticks. Each endpoint of each stick is colored with some color. Is it possible to align the sticks in a straight line such that the colors of the endpoints that touch are of the same color?
输入
Input is a sequence of lines, each line contains two words, separated by spaces, giving the colors of the endpoints of one stick. A word is a sequence of lowercase letters no longer than 10 characters. There is no more than 250000 sticks.
输出
If the sticks can be aligned in the desired way, output a single line saying Possible, otherwise output Impossible.
样例输入
blue red
red violet
cyan blue
blue magenta
magenta cyan
样例输出
Possible
提示
Huge input,scanf is recommended. -2009 PKU ACM/ICPC Trainning 14
Colored Sticks
2009 PKU ACM/ICPC Trainning 14
Colored Sticks
F:Colored Sticks
时间限制:
5000ms
内存限制:
65536kB
描述
You are given a bunch of wooden sticks. Each endpoint of each stick is colored with some color. Is it possible to align the sticks in a straight line such that the colors of the endpoints that touch are of the same color?
输入
Input is a sequence of lines, each line contains two words, separated by spaces, giving the colors of the endpoints of one stick. A word is a sequence of lowercase letters no longer than 10 characters. There is no more than 250000 sticks.
输出
If the sticks can be aligned in the desired way, output a single line saying Possible, otherwise output Impossible.
样例输入
blue red
red violet
cyan blue
blue magenta
magenta cyan
样例输出
Possible
提示
Huge input,scanf is recommended. -2009 PKU ACM/ICPC Trainning 14
Colored Sticks
(系统自动生成,下载前可以参看下载内容)
下载文件列表
Colored Sticks.cpp