Those FRICKING monkeys stole your stuff! Get it back!
(Also, remember to leave a comment if you did something interesting )
Those FRICKING monkeys stole your stuff! Get it back!
(Also, remember to leave a comment if you did something interesting )
Now playing: Da Banana Bunch (DK64).mp3
Jump in the discussion.
No email address required.
Yes i needed to include an external library to split a string in c++ and no dont ask me why i decided to make things into pointers or i have struct that only stores one value.
Also at first i assume that all throws needed to happen at the same time. So if Monkey 1 throws to Monkey 3, Monkey 3 will not throw that item in the same round again. This was not the case, and Monkey 3 would immediately keep throwing it further in the next throw.
Jump in the discussion.
No email address required.
lmao I just used
std::regex
(yeah I know) another way would be to usesize_t pos; std::stoull(line.substr(18, &pos))
and then recallsubstr
andstoull
from positionpos + 1
until you're left with an empty substringhttps://en.cppreference.com/w/cpp/string/basic_string/stoul
Jump in the discussion.
No email address required.
More options
Context
Actually found a way to optimize this. erase on a vector is slow because it had to rearrange the entire vector, but since we know that a monkey will throw all items, the vector will be empty at the end and we can just reset it with clear.
With that optimization 70% of the cpu time is spent on doing modulo operations
Jump in the discussion.
No email address required.
More options
Context
Wow, you must be a JP fan.
Jump in the discussion.
No email address required.
More options
Context
More options
Context