11052 - Economic phone calls
Moderator: Board moderators
-
- Guru
- Posts: 724
- Joined: Wed Dec 19, 2001 2:00 am
- Location: Germany
I've got WA!
Somebory can give me a hint?
This is my code:
Somebory can give me a hint?
This is my code:
Code: Select all
Removed, I had not understood the problem correctly!
Last edited by joeluchoa on Tue Aug 15, 2006 1:51 pm, edited 2 times in total.
I used backtracking to consider all possibilities... I'm also curious whether it can be solved using greedy?
Visit my script to hunt UVA problem here:
http://felix-halim.net/uva/hunting/
-----------------------
Felix Halim
http://felix-halim.net/uva/hunting/
-----------------------
Felix Halim
-
- A great helper
- Posts: 481
- Joined: Sun Jun 19, 2005 1:18 am
- Location: European Union (Slovak Republic)
Not working for:joeluchoa wrote:I've got WA!
Somebory can give me a hint?
Code: Select all
4
04:09:06:59 47 -
02:07:05:49 47 +
09:01:03:11 47 -
01:30:02:34 47 -
0
Code: Select all
2
I'm not understand the above input!!
Why is 2 the output?
You can explain to me?
I think that the answer would be:
3
4
04:09:06:59 47 - [year 2]
02:07:05:49 47 + [year 1]
09:01:03:11 47 - <delete>
01:30:02:34 47 - [year 0 (current)]
What is wrong in my idea?
Why is 2 the output?
You can explain to me?
I think that the answer would be:
3
4
04:09:06:59 47 - [year 2]
02:07:05:49 47 + [year 1]
09:01:03:11 47 - <delete>
01:30:02:34 47 - [year 0 (current)]
What is wrong in my idea?
http://acm.uva.es/problemset/usersnew.php?user=47903
All men are like grass,and all their
glory is like the flowers of the field;
the grass withers and the flowers fall,
but the word of the Lord stands forever.
[1 Peter 1:24-25]
All men are like grass,and all their
glory is like the flowers of the field;
the grass withers and the flowers fall,
but the word of the Lord stands forever.
[1 Peter 1:24-25]
-
- A great helper
- Posts: 481
- Joined: Sun Jun 19, 2005 1:18 am
- Location: European Union (Slovak Republic)
The years of all the phone calls are as follows:joeluchoa wrote:I'm not understand the above input!!
Why is 2 the output?
You can explain to me?
What is wrong in my idea?
Code: Select all
04:09:06:59 47 - [year 1] (as 04>02)
02:07:05:49 47 + [year 1] (as 02<09)
09:01:03:11 47 - [year 0] (as 09>01)
01:30:02:34 47 - [year 0] (as it is the first one)
Code: Select all
04:09:06:59 47 - [delete]
02:07:05:49 47 + [year 1] (as 02<09)
09:01:03:11 47 - [year 0] (as it is the first one)
01:30:02:34 47 - [delete]
Thanks Martin Macko. I hadn't undestood the problem correctly!
http://acm.uva.es/problemset/usersnew.php?user=47903
All men are like grass,and all their
glory is like the flowers of the field;
the grass withers and the flowers fall,
but the word of the Lord stands forever.
[1 Peter 1:24-25]
All men are like grass,and all their
glory is like the flowers of the field;
the grass withers and the flowers fall,
but the word of the Lord stands forever.
[1 Peter 1:24-25]
Sorry, I still couldn't understand it.Martin Macko wrote:The years of all the phone calls are as follows:joeluchoa wrote:I'm not understand the above input!!
Why is 2 the output?
You can explain to me?
What is wrong in my idea?After removing the first and the last one you get:Code: Select all
04:09:06:59 47 - [year 1] (as 04>02) 02:07:05:49 47 + [year 1] (as 02<09) 09:01:03:11 47 - [year 0] (as 09>01) 01:30:02:34 47 - [year 0] (as it is the first one)
Code: Select all
04:09:06:59 47 - [delete] 02:07:05:49 47 + [year 1] (as 02<09) 09:01:03:11 47 - [year 0] (as it is the first one) 01:30:02:34 47 - [delete]
Could someone explain it more detailed?
Strangely, my understanding is different to yours, but I get AC..Martin Macko wrote: The years of all the phone calls are as follows:After removing the first and the last one you get:Code: Select all
04:09:06:59 47 - [year 1] (as 04>02) 02:07:05:49 47 + [year 1] (as 02<09) 09:01:03:11 47 - [year 0] (as 09>01) 01:30:02:34 47 - [year 0] (as it is the first one)
Code: Select all
04:09:06:59 47 - [delete] 02:07:05:49 47 + [year 1] (as 02<09) 09:01:03:11 47 - [year 0] (as it is the first one) 01:30:02:34 47 - [delete]
In my understanding, the years of all the phone calls are as follows:
Code: Select all
04:09:06:59 47 - [year -2]
02:07:05:49 47 + [year -1]
09:01:03:11 47 - [year -1] (the last year)
01:30:02:34 47 - [year 0] (current year)
Code: Select all
04:09:06:59 47 - [delete] (before the first important call)
02:07:05:49 47 + [year -1]
09:01:03:11 47 - [delete] (02 > 01, this one can be deleted)
01:30:02:34 47 - [year 0]
Re: 11052 - Economic phone calls
One more case.
Input:
Output:
Input:
Code: Select all
9
09:16:10:18 0 -
01:12:03:22 0 +
02:22:14:48 0 -
04:05:11:29 0 +
03:04:01:42 0 +
05:10:08:08 0 -
12:18:02:27 0 -
05:01:08:27 0 -
09:08:04:31 0 +
0
Code: Select all
5
Life shouldn't be null.