Google Hash code 2020 (Discussion)

I got 23,250,514 with sorting with t[i] in ascending order and n[i]/m[i] in descending order for picking a library.
How exactly did you use sorting?

What is the approach and how much exactly you got in every subtask?

For F, we maintained a Set to count unique book score from each library and add that to the set.

The score jumped from 2L to 5 for F.

1 Like

We managed to score 23,306,061

Looks like i sucked here as well :sob::rofl:

1 Like

1 Like

Got 25.25M, sorting was the basic idea.

Here is our score! Link to our solution : questionsSolved/hashCode.cpp at master · ankiiitraj/questionsSolved · GitHub

can you share your code for F?

Will share soon. Repos are still in private.


Got this with Greedy Algorithm
Similar to Knapsack

I hope it’s fine to share code, right?

I participated in hash code for the first time and the problem i encountered was that none of the online IDEs were able to handle the large data sets and give an ouput which i could further use as an output file for hash code.

So where should run my code to get an output??

Yes.

1 Like

Offline. on your local machine. Install linux subsystem or get familiar with powershell and install gcc on windows and use ‘<’ to give input to the executable

21,465,662

u know how to take input from file? i know in python but not in cpp and how to output too?

26.6 million points

1 Like

@priyansh19077 that is very impressive. How did you take such a huge input dataset in your program? In python i use a list input method like:

‘’‘books refer as b
libraies define as L
and days define as d’’’
b, L, d = map(int, input().split())
#The next line refer to the scoring(given name of book)
nameofBooks = map(int, input().split())
bn, dn, ls = map(int, input().split())
booklistforL1 = map(int, input().split())
it1 = itertools.islice(t1, b)
bn1, dn1, ls1 = map(int, input())
booklistforL2 = map(int, input().split())

And then i copy the input from dataset and paste it in my program. But it didn’t work properly. My python IDE was stopped working some time later.

1 Like

What I did was that I made class of library and took input in it only for each library. Also, I want to mention that first I tried to do everything in C++ but couldn’t complete it. I guess choosing python for this problem was important. I took the input in the same manner just like you did, except I did not use itertools for the input.

1 Like