bobbilyking's blog

By bobbilyking, history, 13 months ago, In English

Do I just have to switch over from java? Full code: https://pastebin.com/5HDQ6kRa

The logic should be correct but it's TLEing for some cases, and I'm pretty sure I have the optimal logic, but it's either cuz Java is slow or something w/ the implementation of the code

Read more »

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

By bobbilyking, history, 13 months ago, In English

So my implementation of dijkstra's doesn't actually sort the nodes, instead it keeps on duplicating nodes, updating shorter distances. This works, because if there are 2 duplicate nodes and one distance is shorter, it would only check the shorter node and the longer distance node remains forever unseen. However, since you're constantly duplicating nodes, doesn't this take up a bunch of unnecessary memory?

Is that that just pqueue things or is there a better way to deal with this?

Read more »

 
 
 
 
  • Vote: I like it
  • +3
  • Vote: I do not like it

By bobbilyking, history, 14 months ago, In English

can't you just screw over a bunch of people (if the contest allowed hacks) by going on alt accounts, solving the first problem early, lock the problem, go hacking problems, and then start copy pasting and submitting other people's source code onto alts and act as if they plagiarised?

i hope it's not a thing (i've never hacked a solution real time before, but i mean u have to be viewing some source code while hacking right?)

Read more »

 
 
 
 
  • Vote: I like it
  • +16
  • Vote: I do not like it

By bobbilyking, history, 14 months ago, In English

https://pastebin.com/zV3jsqy7

i did look at the CF editorial, and yeah my implementation (i don't think) is wrong. and someone else had the same TLE problem as me but he never said how he resolved it (if he ever did). Is this just a java thing? Editorial says that time complexity is n * target, which is 10^8 operations, so maybe I can make very very slight optimizations somewhere to get it under 1ms?

Read more »

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

By bobbilyking, history, 14 months ago, In English

i'm kinda interested because comp programming is fun but not so much real life programming so i might consider switching majors. does anyone have any stories about being a casual CPer that's not doing STEM related stuff?

Read more »

 
 
 
 
  • Vote: I like it
  • +1
  • Vote: I do not like it

By bobbilyking, history, 14 months ago, In English

i swear to god every other person has a anime profile pic

Read more »

 
 
 
 
  • Vote: I like it
  • +168
  • Vote: I do not like it

By bobbilyking, history, 14 months ago, In English

I'm probably being extremely dumb right now, but for round 641, div2C, I literally had the right solution but I spend 1h30m trying to implement the last part (counting factors and then getting 2nd minimum one) but I couldn't do it w/o hashmaps or arraylists, which ofc MLE. Can anyone help me approach this last part (because the editorials used the first solution, but i used the second so i have nothing to go on)

https://codeforces.com/contest/1350/submission/80029151

Read more »

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

By bobbilyking, history, 14 months ago, In English

It would be interesting to see what kind of problems they'd give if it was codeforces (ofc it can't be too hard since u don't even learn data structures and stuff in CSA)

Read more »

 
 
 
 
  • Vote: I like it
  • +5
  • Vote: I do not like it

By bobbilyking, history, 3 years ago, In English

problem: https://codeforces.com/contest/1070/problem/D

my python solution said it had a runtime error on #5, and compared to my previous solution which gave wrong answer at #6, i really don't see a way how it could give a runtime error.

python: https://pastebin.com/GXnGg7wA

the piece of code that gives "runtime error" for #5:

if remain != 0 and bagsRn != 0: bags+=1

like what? don't understand how that could possibly give a runtime error, it's logically sound and if it gave wrong answer or exceeded time limit it would just say that... not to mention it went through 5 test cases + numerous of my own test cases to try and break it, so at the WORST it should give "wrong answer" not a runtime error

Read more »

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