Giter VIP home page Giter VIP logo

google-hashcode2020_warmup's Introduction

Google HashCode 2020 Warmup

First find the problem statement (pdf file) in my github repo then check this out!


Assuming we have given a maximum score called max and the number of pizza types called types:

max types
t[0] t[1] ... t[types-1]

Then we make count list of each different t to know how many times each unique t appears on the input and we get a count list { x[0], x[1], ..., x[n] } corresponding to the list of all different t values shown as { a[0], a[1], ..., a[n] }.

Now, it is obvious that score can be rewritten as follows:

score = a[0]x[0] + a[1]x[1] + ... + a[n]x[n]

The mathematical description of the problem is the following:

a[0]x[0] + a[1]x[1] + ... + a[n]x[n] <= max

0 <= x[0] <= m[0]
0 <= x[1] <= m[1]
...
0 <= x[n] <= m[n]

Statement: Given the conditions above find the maximum of score.

Since all a values are given we have to find such x values to maximize the score.

How to run

After downloading the project from here open up a terminal from the project folder and enter:

./main [path/to/input] [path/to/output]
  • [path/to/input] is a location of an input file (provided in the directory called in, i.e. in/a_example.in)

  • [path/to/output] is a location of an output file to be saved (i.e. out/a_example.out)

Statistics

Input Score Time Lost Point
a_example 16 0.3 ms 0
b_small 98 0.32 ms 2
c_medium 4496 0.35 ms 4
d_big 999999989 2.3 ms < 11
e_quite_big 504999988 6.7 ms < 12

google-hashcode2020_warmup's People

Stargazers

Imran Ibrahimli avatar Elmar Hajizade avatar Khalig Aghakarimov avatar

Watchers

James Cloos avatar Ali Khudiyev avatar

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.