## 10091 - The Valentine's Day

**Moderator:** Board moderators

### 10091 - The Valentine's Day

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

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

### 10091 WA

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

Please help.

Thanx

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

Please help.

Thanx

### Problem with computeing the number of iterations

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:
it that correct?

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;
```

### WA?

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
```

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

I know it's poor, but this is my 82342456726815th try. I hate guessing...

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--;
}
```

Thiago Sonego Goulart - UFMG/Brazil

### Re: 10091 - The Valentine's Day

can anybody check whether my iterate calculation is right or wrong

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;
}
```

### Re: 10091 - The Valentine's Day

what is the output for following input
i WA code gives

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
```

Code: Select all

`0.03419`

### Re: 10091 - The Valentine's Day

My AC code gives 0.03127.crip121 wrote:what is the output for following inputi WA code givesCode: 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`

Code: Select all

`0.03419`

Thiago Sonego Goulart - UFMG/Brazil

### Re: 10091 - The Valentine's Day

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

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

### Re: 10091 - The Valentine's Day

I got the following output:
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.

Code: Select all

```
0.34694
0.34694
0.03127
```

Thiago Sonego Goulart - UFMG/Brazil