In Codeforces, there are all sorts of intelligent minds: mathematical, algorithmic, and creative minds all come together under one website to create a beautiful platform.
Hold up, there’s still something missing, a gap that, if filled, would make the platform truly marvelous.
Literature.
Most of the code on this platform is robust and correct. But they aren’t beautiful. #define mp make_pair
? What even is "mp
"? This is almost sacrilegious.
They don’t add to the literary beauty of this otherwise great platform.
#define
s aren’t meant to be used this way. Nor are they meant to encode cryptic text like this submission.
The purpose of #define
s are to make Codeforces show its literary beauty, the beauty otherwise obscured by confusing syntax.
This is a beautiful excerpt of Shakespeare. Looking at the actual text is pure eye-candy.
This is what #define
s are for. Not to make confusing code even more confusing, but to make beautiful code even more beautiful.
From now on, keep this inner beauty of CP in mind; when solving problems, try to let out your inner literary mind, and quote from the literary giants.
To beauty or not to beauty, that is the question problem.
#define int long long
ugly
is very useful
Only when the memory limit and the time limit of the problem aren't tight. Otherwise, it will increase both time and memory by almost 2 times.
Please stop saying that time gets 2x increment. I read this like 1e9 times every week. It "used to be the case" when judges only had 32 bit compilers because each 64 bit integer used to go around with 2 clock cycles. Now with 64-bit compilers, the single clock is efficient and the speeds are more of less same.
I dont understand, how do you explain this then
Using long long, TLE: 151025283
Using int, AC (499/1000 ms): 151047340
edit: mixed up order, now fixed
i'd imagine it's something to do with cache accessing being able to fit more 32 bit integers? that's my reasoning for whenever i switch from ll to int for a speedup anyways
This is one of common reasons, but it rarely leads to 2x slowdown. In this case it's about instruction latency/μops. 64-bit division is slower than 32-bit on most architectures, including Intel Skylake, which, AFAIK, is used by Codeforces. Check idiv in instruction timings
Replacing long long with int only for modulo operations, AC: 151587678
The reason I wrote this comment was that there was this problem(I don't remember exactly) I kept getting TLE and I couldn't figure out the issue. After like 2 hrs of debugging I tried changing every element that can be int from long long and it got AC. It was a very frustrating experience and I just wished that people who read this comment don't struggle for a few hours like me. (no offense intended.)
Even though it is useful,it makes code ugly and less readability.
Personally,I choose
typedef
.I prefer choosing
using
in C++11 or later.Improved: 151474510
how about
#define long long int
?It doesn't compile.
quite 1475G - Strange Beauty
rainboy would approve
You can use this or this.
neither are poetic enough though...