Skip to content

Latest commit

 

History

History
36 lines (23 loc) · 1.16 KB

README.md

File metadata and controls

36 lines (23 loc) · 1.16 KB

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