10091 - The Valentine's Day

All about problems in Volume 100. 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
ithamar
Learning poster
Posts: 56
Joined: Mon May 13, 2002 11:58 pm
Location: Venezuela

10091 - The Valentine's Day

Post by ithamar » Fri Sep 27, 2002 1:25 am

Hi everybody.

I try to solve this problem and i just get WA's. I think that this is a easy problem. I simulate month by month to get all the probabilities of every node at the end (This is done with each person). Later i get the probability that Bill and Marsha encounter in any node.

Is my approach wrong. There is something extrange with the data. Help would be appreciated.

Thanxs in advance
Those Who Don't Know History are doomed to repeat it

Yarin
Problemsetter
Posts: 112
Joined: Tue Sep 10, 2002 5:06 am
Location: Ume
Contact:

Post by Yarin » Fri Sep 27, 2002 10:59 am

I hope you've taken into account that there's no Valentines day before the year 470...

windows2k
Experienced poster
Posts: 136
Joined: Sat Apr 05, 2003 3:29 pm
Location: Taiwan

10091

Post by windows2k » Wed Jul 02, 2003 8:13 am

I am bad at math :(
Could someone give me some hints?

ranjit
New poster
Posts: 34
Joined: Fri Jan 30, 2004 11:22 am
Location: india

10091 WA

Post by ranjit » Thu Jan 27, 2005 10:56 pm

I have got WA many times in this problem. I think there are many ambiguties.
For eg. the problem says the persons are transferred every new month. Does that mean

they shift over on the 1st of the new month or exactly one month later. Ofcourse the latter
assumption is instantly proved inconsistent since transfers are not possible from 31st
Jan to 31st Feb for eg.

I would like to know whether there will be exactly R lines of the graph description without any
invalid characters in between since nothing is mentioned very clearly. What does the
problem setter mean when he asks us to ignore the input.Does it mean we have to look for
R inputs or R lines.

Finally can anybody give me some more test cases and clarify the doubts.

I know some of the above doubts are trivial. But WA :cry: :cry:

Please help.

Thanx

Moha
Experienced poster
Posts: 216
Joined: Tue Aug 31, 2004 1:02 am
Location: Tehran
Contact:

Problem with computeing the number of iterations

Post by Moha » Mon Sep 26, 2005 4:42 pm

I got WA in this problem, can anybody help me?
I think i did a mistake in computeing the number of iterations(number of months to iterate)
this is my iteration computing code:

Code: Select all

if(y<470)
     yy=12*(469-y)+13-m,y=469,m=1;
if(m>2||m==2&&d>=14)
     yy+=14-m;
else yy+=2-m;
it that correct?

Moha
Experienced poster
Posts: 216
Joined: Tue Aug 31, 2004 1:02 am
Location: Tehran
Contact:

WA?

Post by Moha » Mon Sep 26, 2005 5:17 pm

This is my code, but i got WA in it. can anybody test my code?

Code: Select all

Code have been removed, I got Accepted!
with especial thanks to mjf :D

tgoulart
New poster
Posts: 42
Joined: Sat Oct 21, 2006 8:37 am
Location: Alegrete, Brazil

Post by tgoulart » Mon Feb 19, 2007 3:13 am

Can someone tell me if this code to find the number of changes is right?

Code: Select all

// months[12] = {1,0,11,10,9,8,7,6,5,4,3,2};

changes = months[m-1];
if (m == 1 || (m == 2 && d < 14))  {
	if (y < 470)
		changes += (470-y)*12;
}
else {
	if (m == 2)
		changes = 12;
	if (y < 469)
		changes += (469-y)*12;
	if (d >= 14)
		changes--;
}
I know it's poor, but this is my 82342456726815th try. I hate guessing...
Thiago Sonego Goulart - UFMG/Brazil

tgoulart
New poster
Posts: 42
Joined: Sat Oct 21, 2006 8:37 am
Location: Alegrete, Brazil

Post by tgoulart » Wed Jun 20, 2007 7:21 am

Just to make it clear, the above test is wrong. A new month means every 1st day.
Thiago Sonego Goulart - UFMG/Brazil

crip121
New poster
Posts: 29
Joined: Tue Jul 08, 2008 9:04 pm

Re: 10091 - The Valentine's Day

Post by crip121 » Sat Mar 14, 2009 5:56 pm

can anybody check whether my iterate calculation is right or wrong :roll:

Code: Select all

long iteration_time(long y,long m,long d) // year, month, day
{
    long x;
    
    if(y<470)
    {
        x = (470-y-1)*12+(12-m+2);
    }
    else if(m<2 || (m==2&&d<14) )
    {
        x = 2-m;
    }
    else
    {
        x = (12-m+2);
    }
    
    return x;    
}

crip121
New poster
Posts: 29
Joined: Tue Jul 08, 2008 9:04 pm

Re: 10091 - The Valentine's Day

Post by crip121 » Tue Mar 17, 2009 5:18 pm

what is the output for following input

Code: Select all

1
460 2 1
20
A B
B C
C D
D E
E F
F G
G H
H I
I J
J K
K L
L M
M N
N O
O P
P Q
Q R
R S
S T
T U
A U
i WA code gives

Code: Select all

0.03419

tgoulart
New poster
Posts: 42
Joined: Sat Oct 21, 2006 8:37 am
Location: Alegrete, Brazil

Re: 10091 - The Valentine's Day

Post by tgoulart » Tue Mar 17, 2009 7:01 pm

crip121 wrote:what is the output for following input

Code: Select all

1
460 2 1
20
A B
B C
C D
D E
E F
F G
G H
H I
I J
J K
K L
L M
M N
N O
O P
P Q
Q R
R S
S T
T U
A U
i WA code gives

Code: Select all

0.03419
My AC code gives 0.03127.
Thiago Sonego Goulart - UFMG/Brazil

marzot
New poster
Posts: 1
Joined: Fri Apr 17, 2009 1:40 pm

Re: 10091 - The Valentine's Day

Post by marzot » Fri Apr 17, 2009 1:49 pm

Hey tgoulart.
With the following input.
Your AC code gives 0.03127.
Mine also gives 0.03419.
But when I subtracted the number of months has passed by 12, I got 0.03127 as you. It doesn't make sense to me. Cause this could mean 469 it's the first year of the valentine's day celebration.
what's the output of these two cases?
{
2
469 1 1
2
A B
B C
A C
469 3 1
2
A B
B C
A C
}
-----------------------------------------
1
460 2 1
20
A B
B C
C D
D E
E F
F G
G H
H I
I J
J K
K L
L M
M N
N O
O P
P Q
Q R
R S
S T
T U
A U

tgoulart
New poster
Posts: 42
Joined: Sat Oct 21, 2006 8:37 am
Location: Alegrete, Brazil

Re: 10091 - The Valentine's Day

Post by tgoulart » Fri Apr 17, 2009 5:33 pm

I got the following output:

Code: Select all

0.34694
0.34694
0.03127
I was talking to crip121 and maybe my calculated number of iterations is wrong. I had a bad time trying to get AC on this, and i tried many ways to find the number of months.
Thiago Sonego Goulart - UFMG/Brazil

Post Reply

Return to “Volume 100 (10000-10099)”