Автор scott_wu, 10 лет назад, По-английски

Hello everyone!

The final round of the 8VC Venture Cup will be held on Feb/28/2016 18:10 (UTC). ecnerwala and I are the problem setters. We want to thank GlebsHP and vnovakovski for help in preparing the contest, stella_marine for fixing the statements, and MikeMirzayanov for creating the Codeforces platform.

The contest is by invitation only to the top 200 contestants and top local contestants from Round 1 and contains six problems. We will also hold rated, out-of-contest participation for both div1 and div2 contestants — all three groups will feature slightly different problemsets. Local contestants will compete onsite in Silicon Valley. OpenGov, one of the featured 8 | VC companies, has been generous to host this competition at their offices; see more details about this awesome company below:

OpenGov transforms the way the world analyzes and allocates public money. With more than 700 government customers across 45 states in a rapidly expanding network, OpenGov is the market leader in cloud-based financial intelligence, budgeting, and transparency for government. The OpenGov platform transforms government financial data into intuitive, interactive visualizations for both internal government users and citizens.

ABOUT 8 | PARTNERS

8 | Partners, which consists of Joe Lonsdale (co-founder of Palantir) and his core team from Formation | 8, is a Silicon Valley venture capital firm that invests in industry-transforming technology companies. The team's investment portfolio includes companies such as those featured below, and a host of other top technology platforms that leverage modern algorithms and data science to power their core business processes. If you are interested to connect, please take a look at http://www.codeforces.com/8vc/apply.

PRIZES
  • Overall 1st place — $2500
  • Overall 2nd place — $1000
  • Overall 3rd-5th places — $500 each
  • Overall 1-50th place — t-shirts with 8 | VC and company logos
  • Local Winner — Dinner with Joe Lonsdale (founder of Palantir, Addepar, & 8 | Partners) and other Silicon Valley technologists
  • Local top finishers — Opportunity to meet with leadership from 8 | VC portfolio companies

The scoring distribution will be standard for all three divisions: 500 — 1000 — 1500 — 2000 — 2500 — 3000

Good luck!

UPD: Due to onsite awards presentation, we will hold final system testing until around one hour after the end of the contest.

Congratulations to the top overall contestants:

  1. tourist
  2. Egor
  3. ikatanic
  4. enot110
  5. DemiGuo

As well as the top onsite contestants:

  1. winger
  2. waterfalls
  3. KADR

Editorial can be found here.

Thanks for participating!

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

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

Will problem set be same for both division and top 200 contestants ?

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

what about difficulty of problems ?

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

I was invited to onsite though didn't get into top-200 in the Round 1. System doesn't allow me to register to "Final Round" because I am not in top-200. Should I go to onsite but compete in "Final Round (Div. 1 Edition)"?

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

stella_marine for translating the problems

Where is Delinur then?

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

what about the format of unofficial div. 1 and div. 2 rounds? how many problems in each, and will they contain the same problems, or some will be different?

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

29.02.2016 00:10UTC+6 -- это же жесть

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

Please let me register in div1 edition, I don't want to lose my ratings

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

How will be the rating system distribution? :/

I mean, will it be combined for all contestants, separated between Div1-Div2, or even Final-Div1-Div2?

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

My internet speed is fluctuating today, so I want to participate unoffiaclly (without registration). Is it possible?

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

Wow, official finals are harder than Div1 set and only the top 200 are participating, hello rating loss.

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

?

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

why contest will be started too late? Now it is mid-night.so...............

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

Впервые пишу контест в свой день рождения :) и могу точно сказать, что как минимум за четыре следующих года такого не повторится :)

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

Please modify the problem statement of DIV2 Problem B, it's confusing and difficult to understand :(

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

Раз 10 перечитал Д, но так и не смог полностью понять что требуется.

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

Not sure what to feel about the problemset

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

Does anyone know what pretest 5 for Div2 C was? (task with XOR, sum given)

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

Somehow someone failed Div 2 C with the test : 7 5

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

Holy shit, this went well. I really really hope I won't fail systests on anything (and that I'll become IGM).

UPD: Epic win.

My (short) solutions for A-E:

A: Process odd bits of X first, even bits afterwards. If the k-th bit of X is 1, what does it contribute to the sum S? If it's even, what can it contribute to S? Special case: subtract 2 if a = 0 or b = 0 is possible.

B: Straightforward, remember the number of orders per day ord(i) and compute a prefix sum of min(ord(i), B) and a suffix sum of max(ord(i), A) for every query — using Fenwick trees.

C: Process the fuel stations from cheapest to most expensive, compute the optimal amount of fuel when exiting that station (you only want to reach the first cheapest); from that, we can find the amount when entering that station and thus the cost.

D: Binary search. Special case: answer = minimum Ai. If we forbid some vertices, we can split the remaining tree into rooted connected components with roots hanging from "forbidden" edges. The DFS-traversal forms a path with some fully traversable subtrees hanging from it. We need tree DP for size/full traversability of subtrees and for a part of the path which goes down, and then merging those <= 2 downward paths + some fully traversable subtrees.

E: The answer is the total number of submatrices — number of submatrices with sum  < K. For every left side of a submatrix, increment the right side, add violas and recompute the number of ways W to choose the top+bottom side. Remember the number of violas at every y-coordinate in a map<>, W is the sum of intervals in which they're the topmost. Small K means those intervals won't span more than K entries in the set<>, so just a few of them need to be recomputed.

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

Я бы смог решить задачу С с помощью ДП, если бы в качестве одного из двух неизвестных чисел подходил ноль. Не успел придумать, как от него избавиться.

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

10s too slow to submit F :(

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

Solution for Div 2 C?

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

как Б(про сумму и ксор) решать нормально? Сам писал что-то типа meet-in-the-middle. Для каждой половины битов писал ДП dp[i][sum] = колво пар чисел длиной i бит с суммой sum. переходы понятны.

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

I hope the System Test won't take forever to start.

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

Problem 627C - Package Delivery is quite similar with 241A - Old Peykan. You increased limits but solution idea is the same.

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

O(N^2) somehow passes pretests for Div2B.

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

What is WA5 in D (DFS)?

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

The difficulty of problems was very appropriate: in all 3 contests, someone solved the second-last problem but no one solved the last problem.

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

D on div 1 is quite similar to this problem: http://www.usaco.org/index.php?page=viewproblem2&cpid=283

The only difference is that that one is slightly harder: B is not necessarily equal to D

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

When .o. forgets to do unsuccessful hacks......

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

I opened B's statement and thought "Ok, let's look for something shorter", then went to E which reminded me of this topic — http://mirror.codeforces.com/blog/entry/23613, which led me to this problem — http://mirror.codeforces.com/contest/364/problem/E and I spent the whole competition (well, after submitting A) trying to change some of the solutions of that problem in order to make them pass without understanding how those solutions worked :D So, yeah, I got what I deserved :D

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

Can Div1 D be solved using stack? Or something more tricky?

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

    You can use deque to maintain remained gas to get a O(m) solution instead of priority queue. but sorting is still needed.

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

    I've solved this task many times (include the first time I come up with this task by myself..)

    So the idea is: you can buy some gas, and at some point you can sell them at the price you bought it.

    • When you are spending gas, spend the cheapest one
    • When you arrive at a station, if there are gas more expensive than the one at this station, sell them all. And then buy as much as you can.
    • When you arrive destination, sell all.

    You can use an array with 2 pointers (left, right) to keep a sorted list of gas with different price and amount.

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

      Another view:

      Each cell has its travel cost (initially INF). When you visit gas station, you need to update the consequent N cells with cellcosti = min(cellcosti, stationcost). Let the starting point have 0 fuel cost.

      Of course you don't store the whole cellcost array, you store only events (add possible cost/remove cost) and sweep from left to right, taking the minimum cost on each segment. So you need a sliding window minimum (using deque). And I also used deque for events instead of 2 pointers.

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

      @cgy4ever: How can we maintain a sorted array in log(n)? Wouldn't insertion (new gas station) take O(n)?

      I was thinking a max-heap (for new station), and a min-heap (for traveling), and another simple array just to store the values. When we extract from either heap, we check from the array if value has been changed by the other heap, and update accordingly, before proceeding.

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

    not sure if correct

    sort all gas stations by cost

    use set<start, end> of gas for gas station and for each gas station insert values and update answer

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

    div1D can also be solved with divide and conquer. solve(l , r) denotes min cost to reach rth point from lth point if we leave with full fuel at l. find the point with minimum fuel cost in range l + 1 to r — 1 , and buy all fuel here or as much as we need to reach rth point and now add solve(l , index) + solve(index , r) to it. Code

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

At first glance, the problem 627E - Orchestra is very similar to 364E - Empty Rectangles.

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

За 16 минут до конца: наконец-то, с 6 попытки сдаю B и решаю пойти ломать решения.

За 13 минут до конца: думаю всё-таки прочитать С, но решать — вряд ли.

За 10 минут до конца: осознаю какой я идиот, что раньше не прочитал С.

За 2 минуты до конца: ВА на втором сэмпле. Быстро разбираю этот сэмпл для поиска ошибки в решении.

За 30 секунд до конца: понял в чем ошибка, исправляю.

За 10 секунд до конца: засылаю.

За 1 секунду до конца: осознаю, что неправильно исправил ошибку.

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

Duh, "Orchestra" was almost the same as http://mirror.codeforces.com/contest/364/problem/E I copy pasted more or less randomly chosen solution (I chose -XraY-'s one) and adjusted it to this problem, but got TLE. After that I compared those two problems more carefully and found out that the fastest out of >80 ACs to "Empty rectangles" runs 2,5s for n<=2500 and k<=6, and here we have 2s, n<=3000, k<=10, so there's no chance that those problems follow exactly the same idea >_>. Only difference in statements is that number of forbidden cells is not larger than 3000 in Orchestra while there is no such constraint in Empty Ractangles and in Empty Rectangles there needed to be exactly k forbidden cells and here less than k (but second difference is not making Orchestra easier).

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

    My solution highly exploits the fact that n ≤ 3000.

    The main idea: Suppose the top side of the rectangle is in row i and the bottom side is in the row j > i. First iterate over all i in any order, for a fixed i iterate over j from r - 1 to i. When we have fixed i and j, we have a horizontal strip of cells, write down for each column how many 1s there are in this column in our strip into an array A. Having this array, it's easy to find how many good rectangles there are in this strip: for each non-zero item j in A we only need to know closest non-zero item to the left prev[j] of it and the first positon from[j] such that on the segment [j, from[j]] the sum of values in A is greater or equal to k.

    Now let's understand what changes when we decrease j by 1. Some values in A decrease by 1 (that's O(n) totally over all j), my idea is that there will be no more than k values of from we need to fix for each changed position j (actually, those positions are no more than k non-zero items to the left of j). I use this fact for a careful recalculation of array from.

    The main difficulty here is how to find a closest non-zero item to the left or to the right in A. I do that by using path compression technique that provides a very fast log factor. So, overall complexity after careful amortized is for all path compression and O(rnk) for all changes in arrays A and from. Overall complexity is . It has pretty easy implementation, though I spent about an hour on optimizing this solution to make it fit into TL, and still, it runs for about 1.7 sec on pretests :(

    UPD: formulas above had a mistake, I've lost the r factor in an analysis. Now it's fixed.

    UPD: 1918 msec on final tests. Damn I feel lucky :)

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

3500 signed up for Div. 2, but only 1000 solved A? Where did the other 2500 go?

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

Any hints to solve Div 2 B- Island Puzzle

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

    move 0 in both arrays in place 1 then check numbers in places 2 to n to each other

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

    Ignore zero in both arrays and then check whether they are cyclic permutation.

  • »
    »
    10 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +9 Проголосовать: не нравится
    1. Read the two lists of numbers.
    2. Remove the number 0 from both of them (can be done while reading)
    3. Rotate the second lists until it starts with the same number as the first list.
    4. Compare if every number in the same position of both lists are the same, if they are --> YES, else NO
    • »
      »
      »
      10 лет назад, скрыть # ^ |
       
      Проголосовать: нравится -8 Проголосовать: не нравится

      Same Idea as mine. But how is it possible that we all came up with the same solution. Is there a proof of its correctness somewhere?

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

        If we have the numbers 0 1 2 3 4 5, we can get all the possible positions of 0 when swapped with its neighbours:

        0 1 2 3 4 5

        1 0 2 3 4 5

        1 2 0 3 4 5

        1 2 3 0 4 5

        1 2 3 4 0 5

        1 2 3 4 5 0

        Here we can see that moving the 0 doesn't affect to the relative order of the other numbers and we can move the 0 to whatever position we like. Then the 0 is not a necessary data we need to keep, we can throw it away.

        We know that we can't change the relative order of the other numbers, then we only can verify that the elements are in the same order.

        I don't know any other proof of correctness.

        Hope this helps you :)

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

        if 0 is in i index, then if you move statue in i-1 index to i then now i+1 index lost its access to 0. Similarly, if you move statue in i+1 index to i then now i-1 index lost its access to 0. So, only indices adjacent to i can make a move. This means no jumping over indices, only sliding. Imagine 0 is like a tiny bubble in a bottle of liquid, tilted 90 degree.

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

    ignore 0, and check if they are rotation of each other

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

    Proof for the method is welcomed.

    Thanks in advance.

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

      if you move 0 to left n times.. 0 will be in same position but remaining array will be rotated once. so you can generate all the rotated arrays. As you cannot place any non zero number between 2 numbers. So, any other array other than rotations cant be generated. Hope thats correct and helps :)

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

      Ignoring the zero in the arrays, the first array can be transformed into the second one only by some finite number of cyclic shifts, (i.e. 2nd array is a rotation of the 1st). That ordering does not change. If 1 is followed by 2 counterclockwise (or clockwise) in the first array, it has to be the same in the second array too.

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

we are waiting for...

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

Please post photos from the onsite contest. :D

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

I'm looking at my code for Preorder Test (Div1 edition task E) for like an hour already and can't understand why it gets TLE#8.

Can any of you guys help me find the bug? I don't think 8 million dfs calls can cause TLE in C++ when TL is 7 seconds.

http://ideone.com/d46vuQ

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

Pending System Testing is the most annoying sentence I've read in a while.

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

http://pastebin.com/dqJRLfCU http://pastebin.com/pfxyMvFQ Task D Div2.

Can anyone explain me, why the first one got WA4 but the second one got AC. It`s not Long Long problems for sure, because max value in this task is about 1e9.

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

the contest ended seconds before I got to send my code for problem Div2 E :( If it was submitted and passed system test I might have ended up in top 20 for the first time :3

anyway, If this code gets accepted later I'm not gonna forgive my slow internet connection >:(

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

It seems like we have to wait all night again.

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

is an editorial going to be published ?

and could anybody kindly give a hint on C div2 ?

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

Oh no!! If I registered, I'd be under 300 rank and I'd be blue right now ;_;

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

DIV2 C can be easily solved using identity a+b=a^b +((a&b)<<1)

from above identity,value of a&b=(a+b-(a^b))/2

now using a^b and a&b,we can count ordered pair easily...

for each bit in a^b and a&b,we have 4 possibilities

(a^b) : (a&b)

1 : 1 (not possible)

1 : 0 (2 cases--> (ai=0,bi=1) or (ai=1,bi=0))

0 : 1 (1 case--> (ai=1,bi=1))

0 : 0 (1 case--> (ai=0,bi=0))

code: 16412578

complexity: O(log(x))

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

I'm in trouble when submitting problem Div2C. In my computer it gives the right answer for the first testcase, but when I submit it, it gives 0 as result, what is wrong. I've tried with Ideone an it gives the same as in my computer. Is anyone having the same problem as me? It's due to any particularity of the CF compiler that I'm not taking care in my code?

https://ideone.com/csKtVP

http://mirror.codeforces.com/contest/635/submission/16418542

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

Could div2 C be solved with the following logic?

Now there is no point in finishing my question, if the comment is hidden :)

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

Can someone please tell why my solution fails? 16414129 I wrote y = Xor sum xor x Then replaced in the sum equation and then tried dp. Similar solution passes but mine fails. I cant get the bug!:(

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

Could someone help me find an error in my submission for Div 1 C -http://mirror.codeforces.com/contest/634/submission/16414568

My logic is that I store the values of the elements in two subtrees, only if they are smaller than a and b respectively. I also keep a count of all active elements (<=a/b) in the subtree as well. I can split the query into two halves and query the correct tree (b one before repairs and a one after repairs.) Could someone please tell me what is my logic/implementation error?

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

When will editorial be published?

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

When editorials will be published ?? Waiting....

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

If anyone wants to know the solution to div 2 C or finals A please have a look at my blogspot.

http://iamayushanand.blogspot.in

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

As the editorials haven't been published yet, here is my greedy approach for problem E from Div 2(635E — Package Delivery)

Let us see for all i from 0 to m if it possible to reach some location such that X[i] ≤ location. Now, to travel the distance between the previous location and the new location, we will have to choose one of the P[i] such that they lie in range [location - n, location]. So let us keep a set of all those locations from which we can start prioritising by lower P[i] and greater X[i](this would also manage duplicates). Keep track of the starting pointer at each i, and for the next i, just iterate it until you reach the lower_bound on that X[i]-n. This is O(nlgn) because each element may be inserted in the set at most once.

Now, this is slightly tricky and I'm not formally sure why it works(intuition rules :P ) but while we are removing these elements, we simply need to check if the element being removed is the best element, and if so, try to jump to X[j]+nth location(where j is that element). This works because for the X[j]+nth location the current set should correspond to the entire range that we would need to check otherwise as well. Now if we don't reach the X[i]th location after all this work, it means that we need to use some other value in the set to jump to the X[i]th location. Implementation of this is not so tough, just checking a few boundary cases is slightly tedious. This is my accepted submission: 16432717

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

8VC has sent me some photos from the Final. I'm glad to see familiar faces. Share them with you:

https://get.google.com/albumarchive/pwa/114907919772955385569/20168VCVentureCupFinal?authuser=0&authkey=Gv1sRgCIfk3s78m9T6sgE&feat=directlink