0% found this document useful (0 votes)
88 views13 pages

Neerc 2011 Analysis

K = 2n - m, is the number of "unused" codes compared to binary encoding k is exactly the max number of codes with n-1 bits. Build a two tries: all words in a dictionary (trie of prefixes) and all words in reverse order (trice of suffixes in reverse order)

Uploaded by

xennygrimmato
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
88 views13 pages

Neerc 2011 Analysis

K = 2n - m, is the number of "unused" codes compared to binary encoding k is exactly the max number of codes with n-1 bits. Build a two tries: all words in a dictionary (trie of prefixes) and all words in reverse order (trice of suffixes in reverse order)

Uploaded by

xennygrimmato
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

Roman Elizarov

Scan the picture top-to-bottom, left-to right Count the number of \ and /:
If even, were outside the polygon If odd, were inside the polygon

Area = (number of / and \) / 2 + number of . that are inside

Find the smallest n, such that: m <= 2n Now k = 2n m, is the number of unused codes compared to binary encoding
k is exactly the max number of codes with n-1 bits

So, to get the answer write


For i in [0, k-1] write binary encoding of i with n-1 bits For i in [k, m-1] write binary encoding of (i + k) with n bits

Precompute the following costs:

Now use dynamic programming:

e[i,j] the cost of placing i-th letter of new text starting from horizontal position j on the caption f[i,j] the cost of leaving a range of horizontal positions [i,j-1] on the caption empty Define subproblem c[i,j] the optimal placing of i letters from new text so that the last i-th letter is placed onto horizontal position j. c[i,j] = min for s in [smin, smax] of c[i-1,j-s-k] + f[j-s,j] + e[i,j]

Answer is min c[len(new_text),j] + f[j+k,n]

Build a two tries:


all words in a dictionary (trie of prefixes) all words in a dictionary in reverse order (trie of suffixes in reverse order)

Use the second trie to count the number of suffixes starting with letters a to z and the total number of suffixes Using the first trie analyze all prefixes:
+count the number of suffixes for all letters that do not constitute the continuation of suffixes +1 all suffixes that are in the dictionary (words)

Analyze which matrilineal family each individual belongs to (the information about fathers should be ignored) A family is either sequenced (at least one individual is) or assign it some unique negative id Now analyze the set of families of alive individuals
Two different positive family ids -> NO Just one family alive -> YES Otherwise -> POSSIBLY

Create a data structure with a skyline of parabolas (list of intervals) Build trivial skyline for each missile Recursively merge those skylines to produce a binary tree interval tree by time, so that log(n) skylines needs to be analyzed for any time range For each node in the time interval tree, build a space interval tree, so that in log(n) a maximum in any space range can be found. Now, each query can be answered in log2(n)

The hardest number to guess is 1

For each prime number in [2,n] range we can ask it, to eliminate all numbers divisible by it But we can do better

All answers are 1. All other possible numbers have to be eliminated by questioning

So we need to group primes into the fewest number of groups, with a product <= n Greedy algorithm will do just fine

For n=6 we can ask 6=2*3 and 5.

Just group 2 with the largest prime so that their product <= n, etc.

For a point and a line, define a family of possible folds that place this point onto this line parameterized by some real t. For two families we need to find t1 and t2, so that lines are the same
Solving this system for t1 gives a cubic equation for t1.
The normals (a1,b1) and (a2,b2) are collinear Any point from the first line lies on the second. Write an equation in the form a(t)*x+b(t)*y+c(t)=0 Where a(t) and b(t) are linear in t, c(t) is quadratic.

Take care of degenerate cases and solve it using binary search Resulting t gives a fold.

Pick a permutation p and a number i

Solution: For all numbers from 1 to n try all their positions and pick the one with max longest common subsequence
By the above properly we get a common subsequence that contains all i from 1 to n

Now try all possible positions for i in p On some of them the longest common subsequence has the length k on others k - 1 Any of the positions that gives an answer k has the following property: i is a part of any common subsequence of length k

For each pair (Fi, d), where d defines one of 4 directions, recursively find:

Track infinite recursion, when we attempt to compute (Fi, d) that is already being computed:
Collapse all current (dx, dy) on stack If they total to (0, 0) the answer is finite If they total to something else the answer is Infinity.

Direction after executing Fi (dx, dy) - position shift after executing Fi max x+y, max x+y, max x-y, max x-y Use memoization Use arbitrary precision numbers (max answer = 10200)

The graph is a tree. We shall connect each leaf to some other leaf, so that there are no bridges. Hang the tree by non-leaf node and recursively solve on subtrees:
Connect leaves in a subtree passing 1 or 2 leaves to the parent level In each subtree connect pairs of dangling leaves, leaving 1 or 2 to return to the parent level On the root level, connect two remaining leaves, or connect one to the root

Model left-to-right traffic assuming t = m


Now move t to t-1 (reverse lane earlier) Having one more queued car at time moment t-1, find the next free time slot (maintain a list of those), thus update the model

Model right-to-left traffic assuming t = 1


Move t to t+1 (reverse lane later) Update the model in a similar way

Having found the total queue time for leftto-right and right-to-left traffic for each t, now find the earliest optimal time t

You might also like