I'm sure most of you know that all mainstream C++ compilers support inline assembly language. But did you know that you can actually embed Python in a similar way?
Here, for instance, I implemented gcd function in Python simply because it's easier and shorter. The rest of the code is in C++: 17084249. (By the way, kudos to Codeforces for correct highlighting of both Python and C++ parts!)
I'm not sure if it can be useful at all, but I thought that it's fun to share. Keep in mind it doesn't work in all compilers though!
Lol very nice, only figured it out when tried pasting code in and saw the large amount of whitespace. Goes to show how little I know about c++ that I actually thought this was possible.
Which compiler do you use?
There are many blogs to teach a topic or a technique. And none of them is close to this one in terms of usefulness. Sir, you amazed me.
This is amazing, but how does c++ interpretate python objects?
What happens if you try to return python list or dictionary?
Can't check it on my own cause I don't have monitor atm :(
Cool post! BTW, this code with slight changes works in another compiler. 17088203
Wow, thank you komendart, finally I understand how it works, it's really genius ;)
The code has some hidden lines :))
+1, Interesting. ;)
I wouldn't say that it's easier or shorter when we consider the template around the function itself, but I can see it having great application elsewhere — for example in bignum problems with not too tight time limits.
slycelote is trolling us. Just open his code in submissions list and scroll to the right)))
HAHA!
April Fool! XD
2 april mode on: It's possible
Best April Fools Ever.
Luckily, I view the code on my cell-phone.