danielaugusto191 / competitive_programming Goto Github PK
View Code? Open in Web Editor NEWSome solutions for programming competitive problems, mainly CodeForces.
Some solutions for programming competitive problems, mainly CodeForces.
Hi. Thanks for your repo.
I am new to competitive programming, and on one platform I came across the following problem. I would be grateful for advice in its optimal solution.
Two binary matrices are given. There can be up to 10^6 elements in a matrix. You need to bring them to the same size and count the number of differences.
The process of increasing the size of the matrix can be described as follows. Let there be a matrix a with height n and width m. Let us want to expand it by α times in height and β times in width.
The result of this increase is the matrix b of height n · α and a width of m · β is such that it b[i][j] element is equal to a[⌊(i−1)/α⌋ + 1][⌊(j−1)/β⌋ + 1, where ⌊x⌋ is the largest integer not exceeding x.
For example, for the following two matrices
110
000
11
the answer is 8 (the final size is 2x6)
000
000
001
01
11
the answer is 13
00
01
10
the answer is 2
In the worst case, if the dimensions of the matrices are mutually simple, then the size of the resulting matrices can be 10^12, and this is a problem.
It is clear that they can be reduced to the same size using the Euclidean algorithm, but I have no further ideas.
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.