11414 - Dream

All about problems in Volume 114. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Post Reply
TimeString
New poster
Posts: 26
Joined: Mon Nov 13, 2006 3:53 am

11414 - Dream

Post by TimeString »

can anybody explain the problem statement?
can more than one path lay on two points?
can one path connect a point itself?
helloneo
Guru
Posts: 516
Joined: Mon Jul 04, 2005 6:30 am
Location: Seoul, Korea

Re: 11414 - Dream

Post by helloneo »

I assumed no for both of your question and got AC.. :-)
yasuh
New poster
Posts: 7
Joined: Mon Jan 07, 2008 5:34 pm

Re: 11414 - Dream

Post by yasuh »

I have no idea to solve this problem.
Would someone give me a hint?
helloneo
Guru
Posts: 516
Joined: Mon Jul 04, 2005 6:30 am
Location: Seoul, Korea

Re: 11414 - Dream

Post by helloneo »

See this thread..

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

I think this is exactly the same problem..
yasuh
New poster
Posts: 7
Joined: Mon Jan 07, 2008 5:34 pm

Re: 11414 - Dream

Post by yasuh »

Thank you, helloneo! I will try!
epilos@CodeHolic
New poster
Posts: 4
Joined: Sat Mar 01, 2008 6:04 am

11414 - Dream

Post 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
sadia_atique
New poster
Posts: 25
Joined: Thu Nov 24, 2011 6:32 am

Re: 11414 - Dream

Post 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
annisizzler
New poster
Posts: 4
Joined: Sat Apr 21, 2012 9:29 am

Re: 11414 - Dream

Post 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.
neha_5
New poster
Posts: 1
Joined: Mon Sep 14, 2015 9:34 am

Re: 11414 - Dream

Post 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.
Post Reply

Return to “Volume 114 (11400-11499)”