Mostafa_Alaa99's blog

By Mostafa_Alaa99, history, 6 months ago, In English

About Div4E

here is my submission: 346532153

as you can see in my code I made this in the end, to make sure that this is really the error

if len(ans) != len(set(ans)): print(1 / 0)

but even though, it didn't give me runtime and um getting this

wrong answer points in output are not distinct (test case 189)

Btw, if someone knew my actual bug, plz tell me, I solved this problem already using PQ but I am struggling with its BS sol even I think I wrote the idea correctly

UPD1: I got the bug, it was I didn't check before x inclusively and valid as well as same with other side so I can fill the k

but this doesn't change the fact that the above error I was getting is strange, so I still need to know why I got it

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By Mostafa_Alaa99, history, 11 months ago, In English

Who saw Div2C today and then said "Ooooh, it is very clear.....segment tree/sparse table with Binary Search ^_^" Are there anyone other than me or am I an Alien? :) I even built the whole range query structure like I was preparing for war. (I have it in my template) Turns out… it was a simple loop with a few ifs and mins. But hey, at least my overkill solution was a bit fast!

Full text and comments »

  • Vote: I like it
  • -24
  • Vote: I do not like it

By Mostafa_Alaa99, history, 17 months ago, In English

There is something very strange I saw in this last contest "Rayan"

Why many LGMs took time like 10-20 mins to solve div2D (this time is equivalent to 2 or 3 hrs of me or maybe more :) ), when I saw that and it was the end of the contest I stopped thinking automatically (not letteraly, like with no motivation) then suddenly many of my friends some of them are Expert about 1750 solved it in nearly this average time and another friend who is ~1150 solved it in nearly less than hr (but unofficial)

is this because constructive problems normally take time or what?

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By Mostafa_Alaa99, history, 18 months ago, In English

UPD2: It is my first time to make a post here, can I know why many people are making downvotes (nearly those didn't write a comment), I think if they told me the reason for that maybe this will be helpful for both of us

Again, someone hacked my B solution coz of the Python Dictionary (this can happen also when using CPP unordered_map)

But I noticed that it can be done using an array because the constraint bi <= k which will allow to avoid Py dict

So, I wonder did the problem setter put this constraint for Python users to be able to solve it also in Python as they can avoid dictionary because of it, or the constraint exists for any other reason?

UPD1: Now, I have used d[str(key)] = value and it works and got ACC not TLE like the previous

Submission: 289783097

brands = defaultdict(int)
for _ in range(k):
    bi, ci = read_numbers()
    brands[str(bi)] += ci

brands = list(brands.values())
brands.sort(reverse=True)
ans = 0
for i in range(min(n, len(brands))):
    ans += brands[i]

print(ans)

the only change is the str(bi) instead of bi, can anyone try to hack it or show me something that will let this not work

coz I really wants to use Python all time (recursion problem has no idea how to solve it yet, but I am speaking now about this problem)

Full text and comments »

  • Vote: I like it
  • -2
  • Vote: I do not like it