{"id":19850022,"url":"https://github.com/neudinger/problem-f-machine-works","last_synced_at":"2025-10-15T02:38:42.367Z","repository":{"id":118677721,"uuid":"247086841","full_name":"neudinger/Problem-F-Machine-Works","owner":"neudinger","description":"Problem F: Machine Works NP complex problem solver Memoisation with Steiner tree","archived":false,"fork":false,"pushed_at":"2021-03-22T16:30:58.000Z","size":170,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-28T23:11:08.190Z","etag":null,"topics":["complex-networks","complex-systems","decision-tree"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/neudinger.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-03-13T14:12:15.000Z","updated_at":"2021-03-22T16:31:01.000Z","dependencies_parsed_at":"2023-11-10T12:43:40.295Z","dependency_job_id":null,"html_url":"https://github.com/neudinger/Problem-F-Machine-Works","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/neudinger/Problem-F-Machine-Works","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neudinger%2FProblem-F-Machine-Works","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neudinger%2FProblem-F-Machine-Works/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neudinger%2FProblem-F-Machine-Works/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neudinger%2FProblem-F-Machine-Works/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/neudinger","download_url":"https://codeload.github.com/neudinger/Problem-F-Machine-Works/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neudinger%2FProblem-F-Machine-Works/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279036968,"owners_count":26090001,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-15T02:00:07.814Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["complex-networks","complex-systems","decision-tree"],"created_at":"2024-11-12T13:24:01.130Z","updated_at":"2025-10-15T02:38:42.362Z","avatar_url":"https://github.com/neudinger.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Machine-Works\nACM ICPC 2011 World Finals Problem F: Machine Works\n\n## Problem F\n### Machine Works Prompt\n\nYou are the director of Arbitrarily Complex Machines (ACM for short), a company producing advanced machinery\nusing even more advanced machinery. The old production machinery has broken down, so you need to buy new\nproduction machines for the company. Your goal is to make as much money as possible during the restructuring\nperiod. During this period you will be able to buy and sell machines and operate them for profit while ACM owns\nthem. Due to space restrictions, ACM can own at most one machine at a time.\nDuring the restructuring period, there will be several machines for sale. Being an expert in the advanced machines\nmarket, you already know the price Pi and the availability day Di for each machines Mi. Note that if you do not buy\nmachine Mi on day Di, then somebody else will buy it and it will not be available later. Needless to say, you cannot\nbuy a machine if ACM has less money than the price of the machine.\nIf you buy a machine Mi on day Di, then ACM can operate it starting on day Di + 1. Each day that the machine\noperates, it produces a profit of Gi dollars for the company.\nYou may decide to sell a machine to reclaim a part of its purchase price any day after you’ve bought it. Each machine\nhas a resale price Ri for which it may be resold to the market. You cannot operate a machine on the day that you sell\nit, but you may sell a machine and use the proceeds to buy a new machine on the same day.\nOnce the restructuring period ends, ACM will sell any machine that it still owns. Your task is to maximize the amount\nof money that ACM makes during the restructuring.\n\n### Input\nThe input consists of several test cases. Each test case starts with a line containing three positive integers N, C, and\nD. N is the number of machines for sale (N \u003c= 105), C is the number of dollars with which the company begins the\nrestructuring (C \u003c= 109), and D is the number of days that the restructuring lasts (D \u003c= 109).\nEach of the next N lines describes a single machine for sale. Each line contains four integers Di, Pi, Ri and Gi,\ndenoting (respectively) the day on which the machine is for sale, the dollar price for which it may be bought, the\ndollar price for which it may be resold and the daily profit generated by operating the machine. These numbers satisfy\n1 \u003c= Di \u003c= D, 1 \u003c= Ri \u003c Pi \u003c= 109 and 1 \u003c= Gi \u003c= 109.\nThe last test case is followed by a line containing three zeros.\n\n### Output\nFor each test case, display its case number followed by the largest number of dollars that ACM can have at the end of\nday D + 1.\n\nFollow the format of the sample output.\n\n##### Sample input\nN is the number of machines for sale (N \u003c= 105),\nC is the number of dollars with which the company begins the\nrestructuring (C \u003c= 109)\nD is the number of days that the restructuring lasts (D \u003c= 109)\nN C  D\n6 10 20\nday on which the machine is for sale\nthe dollar price for which it may be bought\nthe dollar price for which it may be resold\nthe daily profit generated by operating the machine\nDi, Pi, Ri and Gi\n6 12 1 3\n1 9 1 2  \n3 2 1 2  \n8 20 5 4  \n4 11 7 4  \n2 10 9 1  \n0 0 0\n\n##### Output for the Sample Input\nCase 1: 44\n\n\n\n## Run Program\nFrom the terminal command line, run problemf.py with a properly formatted input file.\n\n```\n$ python problemf.py test.txt\nCase 1: 44\nCase 2: 11\nCase 3: 12\nCase 4: 10\nCase 5: 39\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneudinger%2Fproblem-f-machine-works","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneudinger%2Fproblem-f-machine-works","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneudinger%2Fproblem-f-machine-works/lists"}