abeaumont / competitive-programming Goto Github PK
View Code? Open in Web Editor NEWSolutions to problems from various online judges / contest sites.
License: Do What The F*ck You Want To Public License
Solutions to problems from various online judges / contest sites.
License: Do What The F*ck You Want To Public License
I submitted the same solution you provided but it gives time limit exceeded
please recheck the solution of Common Divisors
The solution given for 1628 - Meet in the Middle gives Wrong Answer on the last test case. Kindly check the code.
CAn you please explain why this matrix was constructed in such a way
competitive-programming/cses/1096.cc
Line 38 in 1cc6c64
I know that later part will be solved by matrix exponentiation. But facing some difficulties in building the base matrix
I have a very similar Pythonic solution to greeting card (https://open.kattis.com/problems/greetingcard) by hardcoding the only possible situations where pairs of points are exactly 2018 units apart. However, my solution failed with a "TLE" message failing on the 5/11 test case and I just couldn't figure out why.
Is your solution able to successful pass all the test cases on Kattis?
T = int(input())
lattice = []
for _ in range(T):
x, y = map(int, input().split())
lattice.append((x, y))
count = 0
for index in range(len(lattice)):
cur_x = lattice[index][0]
cur_y = lattice[index][1]
for jndex in range(index, len(lattice)):
nex_x = lattice[jndex][0]
nex_y = lattice[jndex][1]
if ((cur_x + 2018 == nex_x and cur_y == nex_y) or
(cur_x - 2018 == nex_x and cur_y == nex_y) or
(cur_x == nex_x and cur_y + 2018 == nex_y) or
(cur_x == nex_x and cur_y - 2018 == nex_y) or
# more
(cur_x + 1118 == nex_x and cur_y + 1680 == nex_y) or
(cur_x + 1118 == nex_x and cur_y - 1680 == nex_y) or
(cur_x - 1118 == nex_x and cur_y + 1680 == nex_y) or
(cur_x - 1118 == nex_x and cur_y - 1680 == nex_y) or
# more
(cur_x + 1680 == nex_x and cur_y + 1118 == nex_y) or
(cur_x + 1680 == nex_x and cur_y - 1118 == nex_y) or
(cur_x - 1680 == nex_x and cur_y + 1118 == nex_y) or
(cur_x - 1680 == nex_x and cur_y - 1118 == nex_y)):
count += 1
print(count)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.