Блог пользователя bobbilyking

Автор bobbilyking, история, 4 года назад, По-английски

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

Полный текст и комментарии »

  • Проголосовать: нравится
  • -15
  • Проголосовать: не нравится

Автор bobbilyking, история, 5 лет назад, По-английски

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?

Полный текст и комментарии »

  • Проголосовать: нравится
  • +3
  • Проголосовать: не нравится

Автор bobbilyking, история, 5 лет назад, По-английски

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?)

Полный текст и комментарии »

  • Проголосовать: нравится
  • +16
  • Проголосовать: не нравится

Автор bobbilyking, история, 5 лет назад, По-английски

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?

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

Автор bobbilyking, история, 5 лет назад, По-английски

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?

Полный текст и комментарии »

  • Проголосовать: нравится
  • +1
  • Проголосовать: не нравится

Автор bobbilyking, история, 5 лет назад, По-английски

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

Полный текст и комментарии »

  • Проголосовать: нравится
  • +168
  • Проголосовать: не нравится

Автор bobbilyking, история, 5 лет назад, По-английски

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.net/contest/1350/submission/80029151

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

Автор bobbilyking, история, 5 лет назад, По-английски

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)

Полный текст и комментарии »

  • Проголосовать: нравится
  • +5
  • Проголосовать: не нравится

Автор bobbilyking, история, 6 лет назад, По-английски

problem: https://codeforces.net/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

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится