By proofbycontradiction, history, 19 months ago, Could we have a tag for interactive problems? That way we could search for interactive problems of a certain difficulty, like *2400 + interactive. By proofbycontradiction, history, 20 months ago, This is a problem that I've been thinking of for quite a while.

You start with the empty string. There will be $q$ queries. Each query will append a character to the string. You have to answer if the new string is a palindrome.

• "" — add A ----> "A" = True
• "A" — add B ---> "AB" = False
• "AB — add A ---> "ABA" = True
• .... and so on for $q$ steps.

Is there an efficient (better than $O(q^2)$) online solution for this problem? By proofbycontradiction, history, 22 months ago, Exactly what the title says: How to search for all the previous Interactive Problems On Codeforces?

I'm very fired up after the question in the previous contest. By proofbycontradiction, history, 22 months ago, Hi all,

Consider n lattice points in a 2D grid {(x1, y1)....(xn, yn)}. A point (x1, y1) is said to dominate another point (x2, y2) if and only if x1 > x2 and y1 > y2. Obviously this dominance relation defines a DAG: G has an edge if point u dominates point v. Let us call this the dominance graph.

My question is this, is it possible to efficiently (say in time O(nlog(n))) compute the dominance graph?

Obviously, the dominance graph could have O(n2) edges. For example, if every point lies on the x = y line, then each point would dominate all points below it, giving us nC2 edges. But I would be happy with a graph that would INDUCE the dominator graph by transitivity.

So, in the example above, instead of nC2 edges, it is sufficient to keep n - 1 edges.

This is not from any contest. It's just something that I'm curious about and haven't been able to make progress on. I don't even know if this graph is going to be sparse enough to be explicitly computed. dag,
By proofbycontradiction, history, 2 years ago, I was solving this interesting number-theory + trees problem. And I came up with an solution where n ≤ 200000.

My idea is that the answer for every node will either be a factor of the root or be a factor of the number itself, and only these about values need to be tested.

However, this submission am getting TLE with this idea. The solution in the editorial is a slight optimization of my idea -
(a) either the answer is a factor of the root (because root is NOT marked as 0)
(b) or it's the GCD of all the ancestors except the root (because the root IS marked as 0).

This has the complexity of O(n * k) where k =  number of factors of the root value, and . Thus the editorial solution and my solution have the same (theoretical) complexity.

Could you suggest was that are C++ implementation optimizations that I could use to improve my solution and avoid the TLE even though I am testing out both factors of root and factors of the node? I did try to cache the values of the root and the node, but that leads to a stack overflow.

I am not looking for the obvious optimizations of implementing the editorial solution. c++,
By proofbycontradiction, history, 2 years ago, In programming contests, I see that many of the codes that require an implementation of a balanced BST actually use a splay tree. Why do you use them over other trees that offer stronger guarantees such as AVL trees and Red Black?

For example, see this solution by tourist.

Are they that much faster than other trees (like quicksort or binary search trees)? Or do they have some interesting non-trivial properties that are especially useful? What I mean to ask is if there are questions where using a Splay Tree gives a much better result than using other kinds of trees. By proofbycontradiction, history, 2 years ago, I am trying to solve Problem M: Counting Marbles. I am writing an editorial in case somebody might need it after me, and I am also trying to ask for help in spotting the error in my code.

Editorial:
We are essentially trying to write the smallest base-365 number with the marbles. So we must minimize the earlier digits as much as possible.

Use a priority queue with the tops of the stack, and whenever you use a marble, remove it from the priority queue and put the next element in the queue instead. Please see my solution for one such implementation.

Help: My solution is able to run on the sample test cases, but I'm getting WA (could somebody take a look at this)?

EDIT: This editorial is incorrect. By proofbycontradiction, history, 3 years ago, Hi codeforces,

I was attempting to solve the KMP problem below, but I'm failing on testcase 3.When I run the testcase locally, I am getting the correct answer on my machine. Could somebody help spot the bug that is probably causing undefined behaviour? kmp,
By proofbycontradiction, history, 4 years ago, I have been trying to solve the problem Nudist Beach, here at http://codeforces.com/contest/553/problem/D. However, I find that when I submit I get a different output as that from ideone, or my local compiler. Even more strangely I get different results depending on whether I submit the file, or whether I copy-paste the code into the editor.

When I submit by file, I get a response of WA on the first testcase. When I submit by copy-paste, I get time limit exceeded. When I run the same code in ideone, or my local compiler, for the first testcase, I get the correct output instantaneously. 