Page 1 of 1

11414 - Dream

Posted: Thu Jul 10, 2008 9:21 am
by TimeString
can anybody explain the problem statement?
can more than one path lay on two points?
can one path connect a point itself?

Re: 11414 - Dream

Posted: Thu Jul 10, 2008 2:25 pm
by helloneo
I assumed no for both of your question and got AC.. :-)

Re: 11414 - Dream

Posted: Thu Jul 24, 2008 5:03 pm
by yasuh
I have no idea to solve this problem.
Would someone give me a hint?

Re: 11414 - Dream

Posted: Fri Jul 25, 2008 3:48 am
by helloneo
See this thread..

http://acm.uva.es/board/viewtopic.php?t=6464

I think this is exactly the same problem..

Re: 11414 - Dream

Posted: Sat Jul 26, 2008 3:27 pm
by yasuh
Thank you, helloneo! I will try!

11414 - Dream

Posted: Sat Aug 30, 2008 6:43 pm
by epilos@CodeHolic

Code: Select all

#include <stdio.h>

int testcase;
int point_num;
int arr[101];
int cnt;

int main()
{
	freopen("data.txt","r",stdin);
	int i,j;
	scanf("%d", &testcase);
	while(testcase--)
	{
		cnt=0;
		scanf("%d", &point_num);
		for(i=0 ; i<point_num ; i++)
		{
			scanf("%d", &arr[i]);
		}
		for(i=0 ; i<point_num-1 ; i++)
		{
			for(j=i+1 ; j<point_num ; j++)
			{
				if(arr[i]<arr[j])
				{
					int temp = arr[i];
					arr[i] = arr[j];
					arr[j] = temp;
				}
			}
		}
		while(++cnt<point_num)
		{
			int temp = arr[0];
			for(j=1 ; j<=temp ; j++)
			{
				while(!arr[j])
				{
					j++;
					if(j>=point_num)
						break;
				}
				if(j<point_num){
					arr[j]--;
					arr[0]--;
				}
			}
			for(i=0 ; i<point_num-1 ; i++)
			{
				for(j=i+1 ; j<point_num ; j++)
				{
					if(arr[i]<arr[j])
					{
						int temp = arr[i];
						arr[i] = arr[j];
						arr[j] = temp;
					}
				}
			}
		}

		if(arr[0])
		{
			printf("No\n");
		}
		else
			printf("Yes\n");			
	}

	return 0;
}
I got TLE...
Plz give me critical case?
help me....T.T

Re: 11414 - Dream

Posted: Sun Jul 29, 2012 12:27 pm
by sadia_atique
I'm getting WA for this problem,I used Havel Hakimi algorithm,first checked for negative and odd number of odd degrees,then within a loop decremented the degrees according to the algorithm.I can't get what went wrong,I even checked with test inputs,and it passed..someone please help :(

Code: Select all

got AC after considering the case n==0

Re: 11414 - Dream

Posted: Mon Jul 30, 2012 8:24 pm
by annisizzler
for those who are getting WA.i have got wa for about 10 times because of this line:

Code: Select all

   while(scanf("%d",&cases)!=EOF){
       while(cases--){
             .........
      }
  }
here cases is case no.
but when i changed this to..

Code: Select all

     scanf("%d",&cases);
     while(cases--){
          ..........
    }
i got AC.

Re: 11414 - Dream

Posted: Mon Sep 14, 2015 9:39 am
by neha_5
Hi,

I am new to UVA, can someone please help me in solving Dreamquestion. some hint or something.
I read above post and found this link for hint http://acm.uva.es/board/viewtopic.php?t=6464.
But this is not opening.. any help plz.. or there is provision to check others code in this site.