Giter VIP home page Giter VIP logo

14501's Introduction

"14501"

made by Jaehyeok Choi

Welcome to Jaehyeok's github!

What is the problem?

FAIL TO SOLVE ALONE

button

What Algorithm should I use?

dynamic programming

What was the key point and the hard part?

Because time limit is 2 seconds, I though it can be solved with brute and force approach.

However, I failed to find the better solution, so I search for the internet.

The best solution's key is back-to-front approach. It means that fill the p array from day n.

To start with day 1 to n has lot of things to think. All cases (k=current calculating location, 1 day work + k day work, 2 day work + k day work,....... and find max)

But if I see from day n, there is no problem with the schedling because just comparing the (max value until current day) and (taking current day's work + max pay after taking current day's work) and find max.

If not taking the current day's work, then update the p[i] with p[i+1] will work. Only thing I have to check is that t[i] + i is bigger than the n.

To deal with that case, I make 17 length array(I'm going to start with the array index1) and fill the array with 0. If t[i] + i is bigger than n, just keep the eqaution p[i] = p[i+1] so that p[n] is over the due(n) fill it with 0.

The reason why I'm doing this is keep the situation that day in the middle is over due(n), the p array will be 0 and that makes error.

Where can I get more help, if I need it?

You can contact me through email, which is [email protected]. Thank you for visiting this github!

14501's People

Contributors

bulttaeng avatar

Watchers

 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.