10661 - The Perspectographer
Moderator: Board moderators
10661 - The Perspectographer
Hi,
Isn't the solution here just to find the largest full subgraph?
Isn't the solution here just to find the largest full subgraph?
-
- Guru
- Posts: 724
- Joined: Wed Dec 19, 2001 2:00 am
- Location: Germany
-
- Guru
- Posts: 724
- Joined: Wed Dec 19, 2001 2:00 am
- Location: Germany
Edit: Forget my old post 

Last edited by Adrian Kuegel on Tue Jun 08, 2004 10:06 am, edited 1 time in total.
-
- Learning poster
- Posts: 63
- Joined: Mon Dec 22, 2003 5:05 am
- Location: Russia, Chelyabinsk
- Contact:
Assume graph with vertex as pieces and edge between vertex meansAdrian Kuegel wrote:You misunderstood the problem. You shouldn't find lower bound. Otherwise 0 would be also a solution for all test cases, or why not?
this two pieces overlapped.
Ok ?
So I need to find minumum number of colors to color graph in such a way
that two adjacent vertex haven't same color.
Right ?
The number of color is number of level (that is chromatical graph number)
May be I something misunderstood.So you should output a number of levels, with which it is possible to assign each adjacent pieces to different levels. And the minimum of these values is not chromatic number, it can be higher.
Can you give the example where chromatical number isn't answer to problem ?
Thanks in advance
You should find a lower bound, but you must find that very special lower bound which also happens to be an upper bound.
I think there's just some confusion in terminology here. The chromatic number of the graph is the minimum number of colors needed to color it, which at least is what my AC solution outputs.

I think there's just some confusion in terminology here. The chromatic number of the graph is the minimum number of colors needed to color it, which at least is what my AC solution outputs.
-
- Guru
- Posts: 724
- Joined: Wed Dec 19, 2001 2:00 am
- Location: Germany
Not sure it's very tricky, but you could try:
Output:
Code: Select all
4
5 5
A B
B C
C D
D E
E A
5 0
5 1
D E
10 15
A B
B C
C D
D E
E A
A F
B G
C H
D I
E J
F H
H J
J G
G I
I F
Code: Select all
3
1
2
3
Het Got AC
Well thabks Farid and Per!
Farid for your response (BTW: my code wasn't wrong, the initialization routine was
)
And Per for your i/o- that was GREAT!
Regards
Suman
Farid for your response (BTW: my code wasn't wrong, the initialization routine was

And Per for your i/o- that was GREAT!
Regards
Suman
Last edited by sumankar on Fri Jun 11, 2004 11:49 am, edited 1 time in total.
-
- Experienced poster
- Posts: 131
- Joined: Thu Apr 17, 2003 8:39 am
- Location: Baku, Azerbaijan
I think your algo isn't correct enough. It finds only a correct coloring, but not the minimal coloring.
I know an algo where:
1. you find a correct coloring:
at each step you try to color a vertex with a minimal possible color.
if you don't find minimal possible then you increase color count.
2. try to change color at the vertex with maximal color
to do it first try to change colors (change by possible greater color value) of adjancent vertexes.
if you cannot do anything above then you've the minimal color count.
Thanks.
I know an algo where:
1. you find a correct coloring:
at each step you try to color a vertex with a minimal possible color.
if you don't find minimal possible then you increase color count.
2. try to change color at the vertex with maximal color
to do it first try to change colors (change by possible greater color value) of adjancent vertexes.
if you cannot do anything above then you've the minimal color count.
Thanks.
_____________
NO sigNature
NO sigNature
I think some people who replyed misunderstood the initial poster's meaning.Finding the number of the largest clique is indeed one way to solve the problem.In this problem you needn't find the largest clique of the whole graph but the one which contains current piece(that's enough).So using loops to count is enough.Hope it'll be helpful.
ps.The graph is defined as follows:If two peices are unnecessary overlapped there is an edge between them.
ps.The graph is defined as follows:If two peices are unnecessary overlapped there is an edge between them.
I am getting WA, I get Per's sample correct.
I used greedy, that is try to see in which level can i place A( starting from 1), and then for B and so on.
[cpp]
Wrong Algorithm
[/cpp]
I used greedy, that is try to see in which level can i place A( starting from 1), and then for B and so on.
[cpp]
Wrong Algorithm
[/cpp]
Last edited by shamim on Sat Jun 12, 2004 2:22 pm, edited 1 time in total.