|
Titlul: 087 Gard Scris de: Mircea Pasoi din August 30, 2005, 00:23:17 Aici puteţi discuta despre problema Gard (http://infoarena.ro/problema/gard).
Titlul: 087 Gard Scris de: Marius Stroe din Februarie 04, 2006, 20:50:43 ce complexitate ati gasit la problema asta ? eu am N * N * K, ceea ce e destul de mult... :( cum pot sa scap de un N ?
Titlul: 087 Gard Scris de: u-92 din Februarie 04, 2006, 20:57:01 cu cateva observatii utile devine N*K :P
daca nu te prinzi, problema asta a fost data la oni 2002 la baraj (dupa cum scrie si in enunt :) ) Titlul: Răspuns: 087 Gard Scris de: Hendrik Lai din Iulie 08, 2010, 10:24:37 Hi,
I am stuck in this problem :sad:, could someone explain how to solve it in O(N*K)? Thanks Hi, any body here? Please help me :'(I am stuck in this problem :sad:, could someone explain how to solve it in O(N*K)? Thanks It would be nice if you would edit your previous messages when consecutively posting on the same subject. ah.. sorry for that. Ok I will do it from now on. Thx for the advice Titlul: Răspuns: 087 Gard Scris de: Simoiu Robert din Iulie 12, 2010, 09:26:34 I can give you the official source, if it helps you :wink:
Titlul: Răspuns: 087 Gard Scris de: Hendrik Lai din Iulie 12, 2010, 11:14:09 hm.. thx for replying :). I would be happy if someone can give me some hints and I tried it myself :?
Titlul: Răspuns: 087 Gard Scris de: Paul-Dan Baltescu din Iulie 12, 2010, 12:09:53 I can't remember the exact details, but you should use a deque in order to improve the DP to run in O(N*K). If this hint is doesn't help you enough, I'll think of the problem in a couple of days and post a more detailed solution.
Titlul: Răspuns: Răspuns: 087 Gard Scris de: Hendrik Lai din Iulie 21, 2010, 01:48:27 I can't remember the exact details, but you should use a deque in order to improve the DP to run in O(N*K). If this hint is doesn't help you enough, I'll think of the problem in a couple of days and post a more detailed solution. hm.. I still don't get the idea how to solve it with a deque :( Further helps needed :)Titlul: Răspuns: 087 Gard Scris de: stardust din August 24, 2012, 19:24:08 Salut ! Am nevoie de putin ajutor la problema asta. Eu m-am gandit asa. dp[ i ][j] - suma maxima ce se poate obtine daca ultima scandura vopsita de muncitorul i este j. Doar ca ma incurc cand trebuie sa fac deque-ul. De fapt, mai general, chestia e urmatoarea : am un vector cu n numere. Si pentru o pozitie fixata x stiu ca pot sa merg inapoi y pozitii. Imi trebuie maximul dintre a[x-i]+c*i, unde c constat si 1<=i<=y. Se poate face asta cu deque ? Si daca da cum ?
Si daca nu se poate cam cum ar trebui rezolvata problema ? Titlul: Răspuns: 087 Gard Scris de: Tudor Tiplea din August 25, 2012, 00:02:27 Salut! Nu am facut problema asta, dar cred ca iti pot raspunde la intrebarea ta in legatura cu deque. Avand in vedere ca fiecare element "creste" constant cu C, la fiecare pas, rezulta ca ordinea elementelor din deque nu se va modifica. Uite o portiune de cod:
Cod:
Cam asa ceva ar veni, sper ca nu am gresit nimic. Bafta! :) |