11414 - Dream
Moderator: Board moderators
-
- 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?
can more than one path lay on two points?
can one path connect a point itself?
Re: 11414 - Dream
I assumed no for both of your question and got AC.. ![:-)](./images/smilies/icon_smile.gif)
![:-)](./images/smilies/icon_smile.gif)
Re: 11414 - Dream
I have no idea to solve this problem.
Would someone give me a hint?
Would someone give me a hint?
Re: 11414 - Dream
See this thread..
http://acm.uva.es/board/viewtopic.php?t=6464
I think this is exactly the same problem..
http://acm.uva.es/board/viewtopic.php?t=6464
I think this is exactly the same problem..
Re: 11414 - Dream
Thank you, helloneo! I will try!
-
- 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;
}
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
![:(](./images/smilies/icon_frown.gif)
Code: Select all
got AC after considering the case n==0
-
- 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:
here cases is case no.
but when i changed this to..
i got AC.
Code: Select all
while(scanf("%d",&cases)!=EOF){
while(cases--){
.........
}
}
but when i changed this to..
Code: Select all
scanf("%d",&cases);
while(cases--){
..........
}
Re: 11414 - Dream
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.
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.