Git Product home page Git Product logo

competitive_programming's Introduction

Competitive_Programming

Some solutions for programming competitive problems, mainly CodeForces.
The solutions are in the solved folder, the first line of each file has a link to the problem.

Makefile Guide:

Compile: make c (or just: make)

Execute: make e

Execute and put output on ap.txt file: make ef (do this will delete last ap.txt file).

New File, with unsolved main.cpp: make n (the unsolved problem goes to waiting folder with the number of the last file.)

New File, with solved main.cpp: make k f="{problem name}" (the solved problems goes to Solved folder with the name given by you).

TODO:

  • Order problems by Tags.
  • Add link reference to all problems.

competitive_programming's People

Contributors

danielaugusto191 avatar

Watchers

 avatar

competitive_programming's Issues

Another problem

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.