Upgrade to Pro — share decks privately, control downloads, hide ads and more …

JOI 2013 春合宿 day4-1 messenger 解説

snuke
March 23, 2013

JOI 2013 春合宿 day4-1 messenger 解説

情報オリンピック2013春合宿4日目1問目messengerの解説

snuke

March 23, 2013
Tweet

More Decks by snuke

Other Decks in Programming

Transcript

  1. 2^29 ≤ 10^9 ≤ 2^30 ͳͷͰɺ30ճͷ΍Γऔ ΓΛ͢Ε͹ X ͷ஋Λ఻͑Δ͜ͱ͕ग़དྷΔɻ A͕ॎԣͲͪΒʹಈ͔ͨ͠ͷ͔͸ɺB͕ಈ͔ͨ͠ޙ

    ͷۨͷҐஔΛهԱ͓͚ͯ͠͹ྑ͍ɻ ͨͩ̍͠λʔϯ໨͸ɺA͕Ͳ͏ಈ͔ͨ͠ͷ͔͕Bʹ ͸෼͔Βͳ͍ͷͰɺࣺͯΔɻ subtask1 (20pts)
  2. A ۱Ҏ֎ʹ B move1 A͔Βελʔτ B͔Βελʔτ A ۱Ҏ֎ʹ B move2

    A ஋఻ୡ΁ B move1 A ۱Ҏ֎ʹ B move2 A ஋఻ୡ΁
  3. ༮ঁ໰୊ ༮ঁ23ਓ͕ͱ͋Δ༸ؗʹด͡ࠐΊΒΕͨ ༮ঁ͸޿ؒʹूΊΒΕࠓޙʹ͍ͭͯ࿩͠߹͏͜ͱ͕Ͱ͖Δ͕Ŋ࿩͠߹͍͕͢ΜͩΒɺ Ұਓͣͭผʑͷ23ࣨͷ෦԰ʹ༓ด͞Εͯ௚઀ͷίϛϡχέʔγϣϯ͸औΓ߹͑ͳ͍ɻ ͦͷޙ23ਓͷத͔ΒŽƃŦƄŷʹ1ਓ͕બ͹ΕΔŇ୭͕͍ͭબ͹Ε͔ͨΛଞͷ༮ঁ͸஌Δ͜ͱ ͕Ͱ͖ͳ͍ɻ બ͹Εͨ༮ঁ͸ผʹ༻ҙ͞Εͨੴ૾ͷ෦԰ͰҎԼͷ2ͭͷ͏ͪͷͲͪΒ͔ΛඞͣߦΘͳ ͚Ε͹ͳΒͳ͍ 1.෦԰ͷதԝͷੴ૾ͷ޲͖Λ90౓ӈ͔ࠨʹճసͤ͞Δ(ੴ૾͸౦੢ೆ๺ͷ͍ͣΕ͔Λ޲͍ ͍ͯΔ)

    2.෦԰ͷதԝͷੴ૾Λഁյ͢Δ ༮ঁ͕1Λߦͬͨ৔߹Ŋ༮ঁ͸෦԰ʹ໭͞Ε࣍ʹŽƃŦƄŷʹબ͹Εͨ༮ঁ͕ಉ༷ͷૢ࡞Λ͢ Δ(ҎԼ܁Γฦ͠) ༮ঁ͕2Λߦͬͨ৔߹ŊͦΕ·Ͱʹੴ૾ͷ෦԰Ͱ1Λߦͬͨ༮ঁ͕શһղ์͞ΕΔ ͨͩ͠Ŋੴ૾ͷ࠷ॳͷ޲͖͸ෆ໌ͱ͢Δɻ·ͨɺͲͷ༮ঁ΋े෼ͳ࣌ؒΛ଴ͯ͹ඞͣબ ͹ΕΔ΋ͷͱ͢Δɻ ͯ͞ɺ͜ͷͱ͖༮ঁୡͷશһ͕࣮֬ʹ༸͔ؗΒղ์͞ΕΔʹ͸ ࣄલͷ࿩͠߹͍ͰͲͷΑ͏ͳऔΓܾΊΛ͢Ε͹͍͍͔