Google Hash code 2020 (Discussion)

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

write these lines:

ifstream cinn("input.txt");
ofstream coutt("output.txt");

replace cin, cout with cinn, coutt respectively.

There’s also another way… I like this one, it’s easy to remember.

no but how can i take input in perfect manner let suppose first line contain 3 integers a,b,c
now second line contain a numbers like that

got it … thank you

1 Like

Please share any idea to improve the score.

what was your team rank ?

after #include filestream
freopen("filename.txt,“r”,stdin)
for ouput replace r with w
and stdin with stdout
just comment freopen line when submitting
use normal input method
and file should be same place as project
also google #ifndef ONLINE JUDGE

I got 25,578,177 points in hash code extended round by using greedy approach to solve the problem and optimizing afterwards. I did not participate in qualification round because it was late at night. By the way, it was my first time and It was just an amazing feeling to get those much points.

@anshulbansal53 You should see this video. :slightly_smiling_face:

1 Like

if you are using linux
you can define it in the ./a.out command

 ./a.out >input-file <output-file

(not sure of the exact syntax i usually use freopen() only)
I saw it in Errichto’s videos

When are the Results are going to be Announced?

dont have any score

codeblocks ide is fine as well
and use filestream

bro please send your hashcode ideone link.

Do you know anyone who have a solution of python 3 for google hashcode 2020 problem? @ssjgz @shim98 Can you help? Do anyone have a solution of python 3.