Hatena::Grouptopcoder

週刊 spaghetti_source

2012-10-06

hogloidhogloid2012/10/06 20:28こんな感じのものは知られていないでしょうか、コメントお願いします:

普通(STLとか)のpriority_queue(以下PQ)を4つ用意する。

一つはminHeap ,もう一つはmaxHeap
両方のPQについて、同じ比較関数の削除用PQを用意する

minHeap、maxHeapは、top()やpop()を呼ばれる度に、
その削除用ヒープと本体でtop()の値が同じ間、削除用ヒープと本体両方でpop()するようにする

push:maxHeap,minHeapにそのままpush
min:minHeapのtop()を見る
max:maxHeapのtop()を見る

minpop:
maxHeapの削除用PQにminHeapのtop()を入れる
minHeapでpop()
maxpop:同様

1回の動作がO(logN)に収まらない場合もありますが、ならしO(logN)になるはずです

何か勘違いしてたらごめんなさい

spaghetti_sourcespaghetti_source2012/10/06 22:59なるほど,Functional DequeをPriority Queueに置き換えたバージョンですね.面白いです.Functional Dequeと同じ解析で,きちんと amortized O(log n)になっています.
名前は聞いたことがありませんが,関数型データ構造の分野では名前があるかもしれません.詳しい方が居ましたら補足お願いします.

折角なので,性能を実測してみました.n = 10100100 ランダム列の挿入削除,multiset以外グローバル配列で実装.g++ -O2.

4-PQ IntHeap multiset
5.03[sec] 3.77[sec] 17.73[sec]

4つ使う実装,優秀ですね.IntervalHeapと比べてこれしか遅れないなら上出来です.実装も相当軽いので,競技ではこれで正解かもしれません.
特にDual Heapとは性質が丸かぶりしているので,そっちを使うくらいならこっちを使え,は間違いなさそうです.

STEWkaxySTEWkaxy2018/07/01 09:21There are different ways to fry tomatoes, but each of them will require the hostess to spend row hours in the kitchen, so this dish is usually better correct prepare on weekends or for special occasions. When tomatoes are roasted, they get a deep taste and are combined with seafood, antipasto and other roasted vegetables. Moreover, they are good suitable for application in the baking industry, in making bread or cake with custard.
<a href=http://stewedtomatoes.top/how-to-can-stewed-tomatoes-at-home>how to can stewed tomatoes</a>

AnnilepeAnnilepe2019/03/15 01:31In the first study of its kind, researchers at the center for brainhealth at the university of texas at dallas and the university of texas southwestern...
<a href=http://anoxia.info/what-is-a-co-occurring-disorder-anxiety-attack>anxiety disorder treatment</a>
4 Men share their honest experiences with anxiety and depression - men's health nanoxia deep silence 3 anthracite

AnnilepeAnnilepe2019/03/16 13:26The purpose of this study was to assess the effect of a soccer match on the cardiac autonomic control of heart rate (HR) in soccer referees. Sixteen...
<a href=http://anoxia.info/hypoxic-ischemic-encephalopathy-neurology-anoxic>anoxic brain damage pathophysiology</a>
Humplinks alcs wakes up, nlcs puts us all back to sleep. - halos heaven social anxiety assessment pdf

YolloWerYolloWer2019/03/18 04:52I really cannot say enough great things about Andrew Davis! He shot our wedding in September and did a phenomenal job! Not only was he extremely
<a href=http://gaselectricity.in/vital-capacity-new-health-guide-electricity>vital capacity</a>
Addicted to your smartphone arianna huffington and samsung have an app for that. - the washington post electricity and magnetism review sheet

BTCzokBTCzok2019/03/29 08:18El sitio web es utilizado por decenas de solteros en 24 paГ­ses de todo el mundo. Si decides actualizar al plan de penthouse, tendrГЎs acceso a su bГєsqueda
<a href=http://bitcoinsp.info/lercheherring2-colourlovers-donde-compro-bitcoins>dobrze zabezpieczone</a>
Casino en lГ­nea demuestra ser un enfoque maravilloso para saborear las estafas de bitcoin

ZukamoxZukamox2019/04/03 15:52Carbon Laser Facial Treatment is now available at Dr. Rachna's Skin Clinic. It is revolutionary treatment for Skin Rejuvenation
<a href=http://chemicalpeel.in/salon-deep-chemical-peel-before-and-after>deep chemical peel before and after</a>
Evaluation of processing tomatoes from two consecutive growing seasons: Quality attributes, peelability and yield Request PDF

TomredTomred2019/04/10 20:09No hay duda, Michael Fred Phelps II es uno de esos atletas que se mantendrГЎ en nuestras mentes y corazones, y en los de las generaciones venideras, por
<a href=http://escoliosislumbar.info/the-microsoft-platform-windows-virtual-desktop-rds>windows server</a>
Blue city health sure - home escoliosis dorsolumbar dextroconvexa

ZycMipsZycMips2019/04/14 14:57Los consumidores ahora estГЎn haciendo su propia investigaciГіn en un dispositivo mГіvil cuando estГЎn en la tienda a travГ©s de anuncios mГіviles y contenido
<a href=http://beneficiosdesegurosocial.cf/concepto-y-significado-de-la-seguridad-social>registro de llamadas</a>
Uc san diego postdocs mclc recurso centro seguridad social calificaciones Obtenga una nueva tarjeta de seguridad social, nГєmero de telГ©fono de seguridad social, cambio de nombre de seguridad social, oficina de administraciГіn de seguridad social, oficinas de seguridad social

BOLDutleBOLDutle2019/04/24 03:25Small Pea sized lump in armpit, what could it be? | Yahoo Answers
<a href=http://armpit.info/how-much-should-you-worry-about-painful-lump-under-armpit/>painful lump under armpit</a>

BernEncoxBernEncox2019/05/25 23:28Ankle soreness results from overuse and exhaustion of your feet: this usually means wearing a new pair of shoes or walking around more than usual. Ankle soreness is distinct from sharp pain, bruising, numbness, tingling, or burning...
http://magdalenabus.tk/page/why-does-my-tongue-feel-burnt/

PozzilibPozzilib2019/05/29 04:06Sanctuary Day Spas: I had a facial and massage - See 476 traveler reviews, 15 candid photos, and great deals for Concord, Canada, at TripAdvisor.
<a href=http://reflexology.nodes.top/art/east-holistic-reflexology/>East holistic reflexology</a>

NoniGapNoniGap2019/06/03 14:19Daniel Ott is the Cosmic Cowboy host of The Edge News Television Broadcast. Every week, along with parodies, investigative and educational journalism, youll hear exciting interviews on topics such as 9/11, Angels, Near Death Experiences, Planetary Anomal
<a href=http://anoxia.info/>anoxia symptoms</a>

CocoirowsCocoirows2019/06/06 05:54DONA International and our doulas have contributed to many articles including pieces by The New York Times, Essence magazine, The Washington Post, The Bump, Fit Pregnancy, and more! Let’s Connect! The DONA Doula Chronicles Blog
<a href=http://massage.nodes.top/art/prenatal-massage-tampa/>Prenatal massage tampa</a>

UhanawUhanaw2019/06/06 23:17Entrancing these considerations into account, we take it our treatment procedure is artistically justi?ed Routine daytime EEGs that comprise at least 20–30 min of slumber may capture ESES, but warning is advised in the occurrence of a negative daytime study in the background of cognitive, behavioral, or wording deterioration In this character the inexperience of others account is more
<a href=http://Haloperidol.nodes.top/haldol-decanoate-injection/1/>Haldol decanoate injection</a>

DENlariDENlari2019/06/11 01:58At Family & Cosmetic Dental Care, is a Johns Creek Dentist. We are proud to serve the areas of Johns Creek, Suwanee, Duluth, and all North Atlanta communities. Our comprehensive family dental practice specializes in building confident smiles through all stages of life, from children to seniors. Dr. Mitul Patel and his team focus on compassion and patient comfort, striving to put you at ease
<a href=http://denta.top/walk-in-dentist/1/>Walk in dentist</a>

BimsixBimsix2019/06/14 14:47But thanks to minimal branding (which consists primarily of the words Johnny Pag etched on the engine case), the Pro Street has a slick, poised
<a href=http://gaselectricity.in/witti-candi-wireless-charging-station-review-mac>phone charging</a>

TesnefTesnef2019/06/18 12:42Have to agree with wee man on this all of my dogs teeth have always been pearly white with no tartar ,I dont feed beef marrow bones but feed raw pork,lamb,chicken and pheasant bones #16 niamh123 , May 6, 2019
<a href=http://tartaronteeth.cf/art/tartar-buildup-on-bottom-front-teeth/>Tartar buildup on bottom front teeth</a>

DOLIkixDOLIkix2019/06/26 10:06At St. Louis Cosmetic Surgery, rapid recovery liposuction helps Belleville, Illinois, patients enhance their contours with reduced downtime. See patient photos.
<a href=http://chemicalpeel.in/acne-scars-before-and-after-chemical-peel-do-they-look>acne scars before and after chemical peel</a>

AcuraZekAcuraZek2019/06/26 20:39A recent report showed that there were nearly 23,000 tenant households in Washington earning at least $150,000 annually as of 2017—one of the highest totals of any major U.S. city.
<a href=http://acjointarthritis.cf/art/simple-arthritis/>Simple arthritis</a>

EGGtecyEGGtecy2019/06/27 16:33Huntersville dentist, Southlake Family and Cosmetic Dentistry is a local, trusted dental practice offering general and cosmetic dentistry, teeth whitening, implants, veneers & other dental care. Call today to make an appointment!
<a href=http://eggrolls.ml/art/egg-roll-nutrition/>Egg roll nutrition</a>

CepMumnCepMumn2019/07/17 13:30bitcoin, Crypto, cryptocurrency news, Industry, market Bitcoin Breaks Parabola With Big Downtrend, a BTC Correction Inbound? After managing to stay situated above $11,000 for a number of days, Bitcoin (BTC) has begun to slip.
<a href=https://bitcoinpor.top/para-ganhar-dinheiro-online-use-estas-dicas-da/>bitcoin forecast</a>

CraftbibCraftbib2019/09/14 07:33A custom Minecraft launcher for installing modpacks,дё‹иј‰Launcherзљ„жєђзўј
<a href=http://minecraft-game.ga/dailymed-inyeccion-de-gattex-teduglutida-polvo>minecraft heads</a>

MikoToorMikoToor2019/09/21 10:58We diagnose and treat all skin, hair, and nail conditions of adults and children including skin cancer screening, hair, nail & skin exams. Call Today.
<a href=http://psoriasisinchildren.ml/art/types-of-psoriasis-in-children1/>Types of psoriasis in children</a>

JonivedJonived2019/09/25 19:2313 Aug 2011 Proper installation is the key for your bathroom sink drain to function well in the long run. As the time goes by, the pipes and drains will loosen
<a href=http://sinkfaucets.cf/art/how-to-fix-a-leaky-bathroom-sink-faucet-double-handle2/>How to fix a leaky bathroom sink faucet double handle</a>

MugohigMugohig2019/10/05 18:37The tumor exhibits a geographically destructive growth pattern, but Gross Findings The gross appearance of malignant fibrous histiocytoma is highly variable
<a href=http://histiocytoma.cf/chemotherapy-and-benign-histiocytoma-human-radiation-therapy-in-the-management>histiocytoma</a>

UhoonupeUhoonupe2019/10/20 16:30COLUMBIA — In the early 1950s, Scotland County, Missouri, had a problem — zero dentists. Then in 1955, Harlo Donelson moved to town and opened up a dental practice. Nearly 55 years later
<a href=http://dentures.denta.top/sitemap.php>Sitemap</a>

BaradFuraBaradFura2019/10/30 16:25Permanent scarring can occur with large cysts or nodules. When acne is severe, it can be extremely traumatic to a teen-ager, leaving life-long Conventional treatments can reduce or even eliminate acne, but in many cases, . He takes a multi vitamin but recently has complained of gas pains i guess from the b vitamins.
<a href=http://howtogetridofacnescars.ga/female-probiotics-how-to-get-rid-of-acne-and-acne-scars-naturally-the-10-best>how to get rid of acne and acne scars naturally</a>

MarloVofMarloVof2019/11/15 13:28I spent a lot of time working for money to buy this laptop, Acer Nitro 5 for gaming TXT file (In notepad ) copy the following line to save> Then save it named However until 2 days ago I could never completely fix my framerate stutter in general gameplay and driving fast around the city. . Bem-vindos ao GTA5-Mods. Then
<a href=http://howtosavemoneyfast.cf/6-simple-tips-for-buying-certified-coins-how-to-make-and-save-money-fast-u-s>how to save money fast</a>

KarenpagKarenpag2019/11/16 01:19Apple cider vinegar has a multitude of uses around the house, and an apple cider To repel ants, prepare this: Ant Repelling Solution. University of Kentucky Entomology. So you can save a bunch of money with this and get rid of your fruit flies effectively - and you don need to wait for the trap to arrive in the mail :-).
<a href=http://howtogetridofantsinhouse.ga/bbc-how-to-get-rid-of-small-ants-in-your-house-future-can-decluttering-your>how to get rid of ants in house</a>

GammaBouhGammaBouh2019/11/29 07:01Вылечи себя от - <a href=https://www.youtube.com/watch?v=phaXc0aqS7Q&t>зоны пробития танков в world of tanks</a>

DelicpAlDelicpAl2019/12/03 08:34Why do I need to report my wages? You are only for UI fraud. Do I report my gross wages or net wages? How do I report my work and wages? If you work or
<a href=http://makemoneyonlinemoney.info/c34e-ways-to-make-small-money-edgeless-in-ceiling-speaker-rsl-speakers>ways to make money</a>

RomondotookRomondotook2019/12/04 07:23It is characterised by dryness of the skin (xerosis), itching (pruritus) and in more severe .. the skin to be dry and itchy and to sometimes develop red, scaly rashes ). . for which an A/B rated generic is available, coverage Spelman L, Zane LT.
<a href=http://itchypatchesonskin.ml/deep-vein-thrombosis-patches-of-itchy-bumps-on-skin-dvt-blood-clot-in-leg>patches of itchy bumps on skin</a>

BardaccibBardaccib2019/12/10 08:41Ageing cable building in Canso Nova Scotia where the first distress call from the Titanic was The owner of two dogs found rat poison in her yard. Body language can tell you a lot about how any dog is feeling in the moment. May cause stomach distress, nausea or vomiting. com Please bookmark us Ctrl+D and come
<a href=http://nauseainthemorning.ml/atlanta-braves-what-causes-nausea-in-the-morning-besides-pregnancy-minor-league>nausea in the morning</a>

DalanopeftDalanopeft2019/12/10 09:29Recovery of Intestinal Parasites in Dogs Treatment and prevention are keys to of killing parasites and controlling secondary fungal infections. , and Notoedres .. Protozoans, as you may remember from junior high biology, are one-celled
<a href=http://yeastinfectiontreatment.info/hhs-declares-public-health-emergencies-ahead-of-hurricane-is-a-yeast-infection>yeast infection</a>