158 - Calendar

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

Moderator: Board moderators

Vexorian
Learning poster
Posts: 100
Joined: Sat Aug 26, 2006 5:50 am

Post by Vexorian »

If there is still a conflict, order them by their appearance in the input stream.

Maybe this is the problem? And the change you made simply made it possible to happen?.

The sample output seems to state to order by date first. It is very fuzzy.

I agree that the problem is not too clear, but it doesn't seem that the correct solution is to not sort it by date first. The relative importance has a good relation with date so it shall work the same for the inputs the judge has. I made a search and this guy seems to have sorted by date first and got AC:

http://acm.uva.es/board/viewtopic.php?t=3715
This problem is not very clearly specified, I tried many possible interpretations before getting accepted. And it took me a long time to get rid of a PE, because i didnt realize the date after Today is: must also be right aligned in a field of 3.
The order is by date, then by priority displayed, then by input order. Notice if two events on the same day have different priority, when asked for that day, these events should be ordered by their input order, since the priority displayed are both *TODAY*.
Agreed, this problem is a guessing game. And there are many more problems like this in the archive.
Well, if you think about it, in this case *today* did have the same number of 'stars' and certainly relative importance, and the problem does say to order by input if there are problems.

Sometimes I wish the problems had more complete input examples but it seems that to the problem designers figuring out the possible catches is part of solving a problem. Makes sense since in real life problem solving no one will tell you the catches.
daveon
Experienced poster
Posts: 229
Joined: Tue Aug 31, 2004 2:41 am
Location: TORONTO, CANADA

Post by daveon »

Vexorian wrote: Makes sense since in real life problem solving no one will tell you the catches.
How true indeed.
rickyliu
New poster
Posts: 30
Joined: Thu Sep 28, 2006 7:16 am

Post by rickyliu »

Vexorian wrote: Well, if you think about it, in this case *today* did have the same number of 'stars' and certainly relative importance, and the problem does say to order by input if there are problems.
*today* is simply the notation and is not related to the relative importance. It is not logical to list a less priority event before the higher one. If you think about it, why the lower priority event is listed before the higher one just for today but not tomorrow or the date after tomorrow?

There is at least another contest which used the same problem treated the relative importance logically.
Sometimes I wish the problems had more complete input examples but it seems that to the problem designers figuring out the possible catches is part of solving a problem.
Provided that the problem description is not ambiguous.
Makes sense since in real life problem solving no one will tell you the catches.
But you will be told what exactly is wrong. A user won't just said WA and ignored you when you asked what's wrong.
adelar
New poster
Posts: 35
Joined: Wed May 02, 2007 11:48 pm
Location: Brasil

output?

Post by adelar »

Hi friends,
someone have AC output to this input?

Code: Select all

1999
A 23 12 5 Partner's birthday
A 25 12 7 Christmas
A 20 12 1 Unspecified Anniversary
A 25 12 7 Christmas So Important
A 26 12 6 Boxing Day
A 26 12 6 Christmas Eve + 2
A 1 1 6 New Year
A 31 12 6 New Year Eve
A 1 1 7 New Year Again
A 2 1 4 Nothing
A 1 3 4 First Day of March
A 28 2 4 Feb Regular
D 31 12
#
have too others outputs and inputs AC

thanks in advance :roll:
adelar
New poster
Posts: 35
Joined: Wed May 02, 2007 11:48 pm
Location: Brasil

AC

Post by adelar »

Thaks, :D
I take AC.
the output is:

Code: Select all

Today is: 31 12
 31 12 *TODAY* New Year Eve
  1  1 ******* New Year Again
  1  1 ******  New Year
  2  1 ***     Nothing
thanks in advance
Abednego
A great helper
Posts: 281
Joined: Tue Sep 10, 2002 5:14 am
Location: Mountain View, CA, USA
Contact:

Re: 158... poor wording?

Post by Abednego »

Oh garbage! Print the numbers after "Today is:" in fields of width 2 as well. After 5 years, I finally got rid of the Presentation Error and got AC.
If only I had as much free time as I did in college...
sixleaves
New poster
Posts: 1
Joined: Fri Nov 16, 2012 10:05 pm

calendar 158

Post by sixleaves »

my english is bad,en...
i have think about it three days?but WA WA?????
anyone can help me?
if you have ACed?can you share your code to me???

my email is?anonysecurity@gmail.com
please~~~
brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: calendar 158

Post by brianfry713 »

Post your code.
Check input and AC output for thousands of problems on uDebug!
peter159
New poster
Posts: 1
Joined: Tue Feb 26, 2013 4:40 pm

Re: 158 - Calendar - WA

Post by peter159 »

in case someone needs...

pNewEvent->pNext = NULL;

should be

pNewEvent->pNext = pEventTemp->pNext; //NULL;
S.H.Bouwhuis
New poster
Posts: 13
Joined: Fri Apr 27, 2007 12:03 pm
Location: The Netherlands

Re: 158 - Calendar - WA

Post by S.H.Bouwhuis »

Well I'll be! I've been looking at this problem for a long time. Thanks for the help!

PS
I used to post under the El-idioto pseudonym, so I'm the dummy who didn't figure out what his problem was.
(\__/)
(='.'=) This is Bunny. Copy and paste bunny into
(")_(") your signature to help him gain world domination.
lighted
Guru
Posts: 587
Joined: Wed Jun 11, 2014 9:56 pm
Location: Kyrgyzstan, Bishkek

Re: i finally figured it out

Post by lighted »

shuniu said
This problem is not very clearly specified... Notice if two events on the same day have different priority, when asked for that day, these events should be ordered by their input order, since the priority displayed are both *TODAY*.
After reading this post i finally got acc. Why the problem statement is still haven't changed. How can we understand that : if two events on the same day have different priority, when asked for that day, these events should be ordered by their input order, since the priority displayed are both *TODAY* from the current problem statement?
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman
jeffli
New poster
Posts: 1
Joined: Sat Apr 30, 2016 12:10 pm

Re: 158 - Calendar

Post by jeffli »

Finally got accepted. Besides the confusion mentioned in the above post, there is no need to append a blank line in the last block. It should be noted that the udebug version requires a blank line in the last blank.

PS: a test case to help to understand the unclear description
if two events on the same day have different priority, when asked for that day, these events should be ordered by their input order, since the priority displayed are both *TODAY*

Code: Select all

1993
A 3 3 5 Partner's birthday
A 1 3 1  Unspecified Anniversary
A 2 1 7 Wedding Anniversary
A 1 1 6 Max's birthday
A 1 1 7 New Year's Day
A 2 1 6 Allen's birthday
D 1 1
#
The output:

Code: Select all

Today is:  1  1
  1  1 *TODAY* Max's birthday
  1  1 *TODAY* New Year's Day
  2  1 ******* Wedding Anniversary
  2  1 ******  Allen's birthday
ekangas
New poster
Posts: 2
Joined: Tue Feb 21, 2017 8:01 am

Re: 158 - Calendar

Post by ekangas »

I got my solution accepted after spending a few hours working with a presentation error, even though the uDebug outputs were the same with my solution. I was using C++11.

So I'm pretty sure the problem was that I was using both iostream for cin as well as printf for output. I was using this without std::ios::sync_with_stdio(false) set. I'm not sure what causes this to get a presentation error, but my last ditch effort to fix the issue was to remove iostream and write the whole answer using cstdio.
rafastv
New poster
Posts: 22
Joined: Tue Jun 19, 2007 3:18 am

Re: 158 - Calendar

Post by rafastv »

Hi, there, my tip for you if you are suffering is to generate all dates in the range of the problem or at least one year with leap day and one year without it for all priorities in all days and then look in the generated answer for errors. And the correct order is DAY / PRIORITY / INPUT ORDER (for days marked as *TODAY* the correct order is INPUT ORDER only and they should be on the top of the group).

Good luck
rafastv
New poster
Posts: 22
Joined: Tue Jun 19, 2007 3:18 am

Re:

Post by rafastv »

yiuyuho wrote: Fri Jan 17, 2003 12:37 am Will there be events that lieing over several days? Or will there be events of the same name? If so, do we need to output both of the event?

What's the output to:
1980
A 3 1 7 1-3-7
A 2 1 7 1-3-7
D 1 1
#


????????
From my AC code:

Code: Select all

Today is:  1  1
  2  1 ******* 1-3-7
  3  1 ******  1-3-7
Post Reply

Return to “Volume 1 (100-199)”