Блог пользователя xiaowuc1

Автор xiaowuc1, история, 9 лет назад, По-английски

Hi all,

The US Open and final contest of the 2017-2018 USACO season will be running from Friday, March 23rd to Monday, March 26th.

As always, please wait until the contest is over for all competitors before discussing any specifics of the contest here.

Update: The contest is now live! Good luck to all competing!

  • Проголосовать: нравится
  • +62
  • Проголосовать: не нравится

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +8 Проголосовать: не нравится

JOI TST 2018 + COI 2018 + USACO Open 2018 + NAIPC 2018 + VK Cup 2018 R2 + ARC 093. Six contests in this week!

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by xiaowuc1 (previous revision, new revision, compare).

»
8 лет назад, скрыть # |
 
Проголосовать: нравится +8 Проголосовать: не нравится

Can we begin discussion?

  • »
    »
    8 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +2 Проголосовать: не нравится

    After 2 hours and 40 minutes, yes.

  • »
    »
    8 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +61 Проголосовать: не нравится

    Very Accurate Depiction of True Events

    • »
      »
      »
      8 лет назад, скрыть # ^ |
       
      Проголосовать: нравится 0 Проголосовать: не нравится

      damn xD

    • »
      »
      »
      8 лет назад, скрыть # ^ |
       
      Проголосовать: нравится +5 Проголосовать: не нравится

      You're joking but seriously how to solve platinum P2?

      • »
        »
        »
        »
        8 лет назад, скрыть # ^ |
         
        Проголосовать: нравится +36 Проголосовать: не нравится

        I think I have a theoretical solution. I haven't coded it up yet but I'm pretty confident it would work.

        Spoiler
»
8 лет назад, скрыть # |
 
Проголосовать: нравится -6 Проголосовать: не нравится

Can anyone explain solutions for platinum P1 and P2?

  • »
    »
    8 лет назад, скрыть # ^ |
    Rev. 3  
    Проголосовать: нравится 0 Проголосовать: не нравится

    Here is my code for P1, I think it's rather simple to understand solution:

    https://ideone.com/agAsKt

    I have not enough time to implement P2, my solution is very complicated and I couldn't well implement self memory management using 5500 mem cells :(

    • »
      »
      »
      8 лет назад, скрыть # ^ |
       
      Проголосовать: нравится +5 Проголосовать: не нравится

      Any brief proof of correctness / logic on why this works?

    • »
      »
      »
      8 лет назад, скрыть # ^ |
      Rev. 2  
      Проголосовать: нравится 0 Проголосовать: не нравится

      .

    • »
      »
      »
      8 лет назад, скрыть # ^ |
      Rev. 3  
      Проголосовать: нравится 0 Проголосовать: не нравится

      It's a little bit difficult for a non-native speaker to explain the idea, but I will try :-)

      • The Moo Sort algorithm is stable, therefore the final positions of all elements are clearly known. W.L.G we can assume that a[1...n] are distinct and the array A is a permutation of (1...n)
      • For technical reason, firstly we run one phase of Bubble Sort to get initial partitioning.
      • For each value x, we want to count the number of segments (sub-array with >= 2 consecutive elements) containing x during Moo Sorting. After each Bubble Sort phase, one value greater than x was moved out of segment ... until x is the largest value of segment. After that we might need one more Bubble Sort phase to move x to the end of segment and get a new unit-length segment containing only {x}, the segment {x} is no longer considered.

      So, the algorithm is: For each value of x, COUNT THE NUMBER OF VALUE GREATER THAN x IN THE INITIAL SEGMENT, and if there's exists one value SMALLER than x placed after x, the counter is increased by 1 (because of extra bubble phase)

»
8 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Can someone check out my code for Plat P3 that uses HLD based on this blog post?

I was only able to get TC 1 and WA on the rest. :(

  • »
    »
    8 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +8 Проголосовать: не нравится

    You don't actually need a segment tree for the chain update part.
    All your updates are "Do ai = min(ai, x), for " right?
    But as your queries are sorted by x, you can rephase your updates as "Set ai = x, if ai is currenty unset". Because if you've set a index before, that will mean it is already less than your current x.
    By this way, you can just keep a set of unset indexes and find the indexes which lie in range [l, r] and update them. In total you'll make , so the total complexity becomes instead of (plus possibly many bugs).

»
8 лет назад, скрыть # |
 
Проголосовать: нравится +33 Проголосовать: не нравится

»
8 лет назад, скрыть # |
 
Проголосовать: нравится +41 Проголосовать: не нравится

»
8 лет назад, скрыть # |
 
Проголосовать: нравится +32 Проголосовать: не нравится

»
8 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

How did you do Gold P1 and P3?

»
8 лет назад, скрыть # |
 
Проголосовать: нравится +13 Проголосовать: не нравится

Results are out.

»
8 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится +24 Проголосовать: не нравится

If we add n=1 case in platinum P1 , many participants' solutions including author's one would be failed. The correct output should be 0 (because length(A)=1) but author's solution outputs 1.

»
8 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

can someone help me debug for plat #3 plz. getting some weird runtime errors for the last few test cases (got cucked by regrading)

code