{"id":18831605,"url":"https://github.com/gebes/colorpyramid","last_synced_at":"2025-09-17T21:22:51.756Z","repository":{"id":137618311,"uuid":"326371343","full_name":"gebes/colorPyramid","owner":"gebes","description":"Perfect solution for the color pyramid example from the IOI","archived":false,"fork":false,"pushed_at":"2021-04-25T12:11:10.000Z","size":12,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-09T09:47:56.278Z","etag":null,"topics":["algorithm","ioi"],"latest_commit_sha":null,"homepage":"","language":"Java","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/gebes.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,"zenodo":null}},"created_at":"2021-01-03T09:35:32.000Z","updated_at":"2022-06-19T17:15:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"d648f78b-713d-4d62-a4b0-864434a88347","html_url":"https://github.com/gebes/colorPyramid","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/gebes/colorPyramid","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gebes%2FcolorPyramid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gebes%2FcolorPyramid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gebes%2FcolorPyramid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gebes%2FcolorPyramid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gebes","download_url":"https://codeload.github.com/gebes/colorPyramid/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gebes%2FcolorPyramid/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275666089,"owners_count":25506162,"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-09-17T02:00:09.119Z","response_time":84,"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":["algorithm","ioi"],"created_at":"2024-11-08T01:55:21.889Z","updated_at":"2025-09-17T21:22:51.730Z","avatar_url":"https://github.com/gebes.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Color Pyramid Problem\n\n## About\n\nThis example is from the IOI. I summarized all the calculation methods I found in the ColorPyramidCalculator.java File.\nThe complexity of this problem with no optimization is\n\n```\nO(N * (N/2))\n```\n\n## The Problem itself\n\nYou have an array of colours. Each colour can be either **R**ed, **G**reen and **B**lue. Those are represented by the letters R, G and B or in the code by 1, 2 or 3.  \n\n```\nRGBG // INPUT\nBRR\nGR\nB // OUTPUT\n```\n\n\nYou mix every row until there is only one colour left which is the output.\n\n### Mixing two colours\n\nAre the two colours the same, then the mix of those is the same.\n```\nRR\nR\n\nGG\nG\n\nBB\nB\n```\n\nAre the colours different, then the mix is the colour which is missing.\n```\nRG\nB\n\nBG\nR\n\nRB\nG\n```\n\n### Mixing rows\nMix the first colour with the second one. The second one with the third one. The third one with the fourth one and so on.\nDo this until you mix the N-1'th and N'th colour. Now you got a new row which is shorter by one.\n\n```\nRGBG\nBRR\nGR\nB\n```\n\nThis solution is the basic one, which can't handle large numbers. \n\n## Target\nYour target is to write an optimization method, that can handle a billion colours within seconds.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgebes%2Fcolorpyramid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgebes%2Fcolorpyramid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgebes%2Fcolorpyramid/lists"}