Maximise the value [Player Potential] (Hack with infy 2020 (ended ) )

will they hire system specialist role this year

They hire only PP (power pogrammer from Hack with infy) …only top 100 candidates onsite hackathon + interview

they don’t hire system specialist role like last year of (top 3000) people?
how do you know bro ?

On their website , , , , go and read over there :slight_smile:

bro if you don’t mind please give the link
thanks in advance!

Don’t worry they hired for SES role . And now about your bruteforce solution . Definately it will fetch some of points like you will get at least more than half i think. As N constraints is 100000 so in worst case we need comparison is (10^5 + 10^5-1 + 10^5-2…+1) = (10^5 * (10^5+1))/2 which is nearly equal to 510^9 and our system gives time limit is 5 second so we can assume that we can iterate nearly 510^9 . So I think brute force will give definitely some points . It may fail on strictly bounded data on 10^5.
@ssrivastava990
@ssjgz

@galencolin Please correct me if i’m wrong

Well, naively, each of the 5 \cdot 10^9 “operations” cause four function calls, which is not exactly ideal in terms of speed

NO this will not call any function . We can just calculate in O(1) in each iteration by using abs

Yes, but abs is a function and may not be inlined by the compiler, so you’re doing 2 \cdot 10^{10} subtractions plus abs operations, right?

1 Like

But any way what you think most of test case can pass this approach ?

From experience, probably not, but I don’t really know how compilers work

1 Like

Yes this might the case , so can i say 80% will get AC while in 20% due to more loop of abs calling will get TLE

To note, you can do abs quickly with a ternary operator, like so:

int x = a < b ? b - a : a - b;

Look up what that is if you don’t know it

But if they are providing partial marks then can i get AC in some of testcae?
I think it will get AC in most of testcase when n is <10^4

I have no idea how their format works, but yes, 5 seconds is generous for n = 10^4 and you’ll probably pass.

Yes i think i should use this

so it may give me a AC . As i used abs , but i used c++ so i think i will get AC in mostly 70 % testcase . Right?
Any way thanks
@galencolin

Maybe? Like I said, I haven’t done this contest before and don’t really know how it works (why do you have to wait so long for a verdict, anyway?), so I don’t know how much credit you’ll get.

@everule1 can you help in this problem ? I mean what you think as they provide 5 second then can we said that bruteforce will work in more than 70% testcase

I’m talking about this

@galencolin help me in this question plz…some pseudo code :slight_smile:

If there are 10 test case then only atmost 2 TC will pass … :slight_smile: