Skip to content

hhkers/hashcode-2021

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Google HashCode 2021 Online Qualifications: Traffic signaling

Our solution for Google HashCode 2021 Online Qualifications

Problem

You can find the problem statements here.

Solution

The code for the solution is in src.cpp. Our approach was a greedy algorithm.

The solution follows these steps:

  1. Read the inputs

  2. Duration of green light:

    1. Count the number of vehicles passing through the each street.

    2. Divide the counts by the weight. (The weight for each file was found by grid search)

  3. Order of green light:

    1. Sort by the number of vehicles at the beginning.

Results

File Score
a.txt (input | output) 2,002
b.txt (input | output) 4,566,011
c.txt (input | output) 1,299,333
d.txt (input | output) 1,606,638
e.txt (input | output) 728,661
f.txt (input | output) 1,411,047
Total 9,613,692

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published