## 11414 - Dream

Moderator: Board moderators

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

### 11414 - Dream

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

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

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

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

Thank you, helloneo! I will try!

epilos@CodeHolic
New poster
Posts: 4
Joined: Sat Mar 01, 2008 6:04 am

### 11414 - Dream

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

New poster
Posts: 25
Joined: Thu Nov 24, 2011 6:32 am

### Re: 11414 - Dream

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

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

Hi,

I am new to UVA, can someone please help me in solving Dreamquestion. some hint or something.