UPD: as pointed out here, the official solution of 2053I2 - Affectionate Arrays (Hard Version) is wrong. We are not sure that the problem is solvable with the current constraints. We will decide how to deal with this issue within tomorrow. UPD: the problem I2 was removed from the offic...
//Codeforces - 1656D #include <bits/stdc++.h> typedef long long valueType; valueType lowBit(valueType x) { return x & -x; } int main() { valueType T; std::cin >> T; for (valueType testcase = 0; testcase < T; ++testcase) { valueType N; std::cin >> N; valueType const...
Pre calculate the powers of 2 modulo M,(wont exceed 60), and try to remove some arrays like andv and orv, they are unnecessary. I think it will be enough. My O(60*n) java solution passed under the time limits (both during contest and multiple times after contest). A link here in...
CodeForces Algorithms. Contribute to m-aprameya/CodeForces development by creating an account on GitHub.
CodeForces Algorithms. Contribute to m-aprameya/CodeForces development by creating an account on GitHub.
I have found an alternative solution to problem F, in complexity O(nlog(n)), like this: First, let's pre-compute the minimum number of moves to get to a certain relative coordinate. We will have 4 arrays, MinPosX, MinPosY, MinNegX, MinPosX, where for example MinPosX[d] is...
The sequences having first i(0<=i<=n-2) digits same will have equal contribution.here's my solution http://codeforces.com/contest/1091/submission/47756044 In my solution I have added n! initially and looped from 1 to n-2 which is same as looping from 0 to n-2. → Reply Samaun...
1417B-TwoArrays.cpp 1417C-kAmazingNumbers.cpp 1418A-BuyingTorches.cpp 1419A-DigitGame.cpp 1419B-Stairs.cpp 1419C-Killjoy.cpp 1419D1-SagesBirthdayEasyVersion.cpp 1419D2-SagesBirthdayHardVersion.cpp 1420A-CubesSorting.cpp 1420B-RockAndLever.cpp 1421A-XORwice.cpp 1421B-PuttingBricksInTheWall....
http://codeforces.com/group/BDIXyZZHhT/contest/205914/problem/F The solution for this problem has a similar merge function (not sure if there's another solution). The limits allow SQRT-Decomposition to pass. There are only update queries, but the same idea solves the range query version. ...
Website crashed as I was clicking submit button in the last minute, didn't come back up until the contest was over. My solution will most likely fail but I think Codeforces stability is a serious issue. Often during the competition I couldn't access the website for a minute or so, and...