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

Автор YF_YUSUF, 7 месяцев назад, По-русски

tierlist

Link to tierlist

Вы можете предложить свои define в коментах, интересные добавлю в тирлист.

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

»
7 месяцев назад, скрыть # |
 
Проголосовать: нравится +5 Проголосовать: не нравится

#define int long longis definitely S tier

  • »
    »
    7 месяцев назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    +1 TLE

    • »
      »
      »
      7 месяцев назад, скрыть # ^ |
       
      Проголосовать: нравится -24 Проголосовать: не нравится

      Actually define int long long doesnt make your code slower in any way , it just makes memory more. I guess thats because of compiler optimizations.

      • »
        »
        »
        »
        7 месяцев назад, скрыть # ^ |
         
        Проголосовать: нравится 0 Проголосовать: не нравится

        then, +1 MLE.

      • »
        »
        »
        »
        7 месяцев назад, скрыть # ^ |
         
        Проголосовать: нравится 0 Проголосовать: не нравится

        On some computer that doesn't support 64bit they emulate that behavior with 32bit integers which costs way more CPU cycles.

      • »
        »
        »
        »
        7 месяцев назад, скрыть # ^ |
        ← Rev. 2  
        Проголосовать: нравится +9 Проголосовать: не нравится

        Can you please stop spreading misinformation so confidently?

        1. At the level of individual instructions, 64-bit idiv (emitted for the integer operations / and % in C++) is significantly slower than 32-bit idiv on x86-64 (a >= 2x difference in latency on some microarchitectures (32 bit latency table vs 64 bit latency table)).
        2. The data cache gets effectively halved (wrt number of elements you can fit) and this can lead to huge slowdowns in programs where memory access is the bottleneck (which is very frequently the case in CP problems).
        3. If your program has a lot of auto-vectorization done by the compiler underneath, you'll now be processing half the number of elements per vector instruction that you could have (this difference will show up even for operations like add and xor that don't have a difference in latency between their 32 and 64 bit scalar versions).
        4. Less importantly for this discussion, 64 bit instructions result in larger object code, which worsens instruction cache efficiency too.
        • »
          »
          »
          »
          »
          7 месяцев назад, скрыть # ^ |
           
          Проголосовать: нравится +1 Проголосовать: не нравится

          You might be right I am not an expert on the topic. Its just for me those points didnt mattered in the practice. Usually when I submit with define int long long i just get more memory and runtime stays roughly same.

          As an example i used the last contest's C, my tight n^2logn solution (which got TLE with sets and got AC with priority_queues) ran even faster by 100ms when I used define int long long (it is probably faster because servers are overloaded in contests). I dont know if it is a special case but I really didnt cherry picked it , and this has been my experience with define int long long generally. I would really like to know if there is a case where define int long long makes the runtime significantly worse (excluding the case where memory becomes too high and causes TLE).

          here are the submissions I mentioned:

          https://codeforces.me/contest/2222/submission/372495229

          https://codeforces.me/contest/2222/submission/372618056

          • »
            »
            »
            »
            »
            »
            7 месяцев назад, скрыть # ^ |
             
            Проголосовать: нравится +1 Проголосовать: не нравится

            actually I tried the same with F , and it was slower by roughyl 200ms so I think you are right:

            https://codeforces.me/contest/2222/submission/372619351

            https://codeforces.me/contest/2222/submission/372619285

            • »
              »
              »
              »
              »
              »
              »
              7 месяцев назад, скрыть # ^ |
               
              Проголосовать: нравится +1 Проголосовать: не нравится

              Here are some code snippets that you can run in custom invocation (use g++ 20) where uncommenting #define int int64_t makes a huge difference in runtime (courtesy gpt, im too lazy):

              just division/modulo
              going through big arrays
      • »
        »
        »
        »
        4 недели назад, скрыть # ^ |
         
        Проголосовать: нравится +1 Проголосовать: не нравится

        I have faced TLE and MLE using it in DP problems for many times.

  • »
    »
    4 недели назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    sure it is. ofc sometimes you need to delete it for optimization, but it's like once in 20 or 30 tasks, which is perfectly okay, since you won't be always think you misplaced int and long long.

»
7 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

itn = int , sigma = signed and int = long long is 100% S+ tier

»
7 месяцев назад, скрыть # |
← Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

This is 100% S+.

#define ll long long

#define all(x) x.begin(), x.end()

#define rall(x) x.rbegin(), x.rend()

#define yes cout << "YES\n"

#define no cout << "NO\n"

#define debug cout << "Debug\n"

»
7 месяцев назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

#define int23_t long long definitely traumatized me...

»
7 месяцев назад, скрыть # |
← Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

S+ defines which i use
D all the rest

»
7 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

#define pofik continue in c tier is crazy

»
7 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

I do #define long long long because I like being chaotic

»
7 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

S+ tier

// ultrakill reference???
#define gabriel cout<<"Machine,\nI will cut you down,\nbreak you apart,\nsplay the gore of your profane form across the STARS!\nI will grind you down until the very SPARKS CRY FOR MERCY!\nMy hands shall RELISH ENDING YOU\nHERE\nAND\nNOW!"; 
// brutal diff gabriel 2 in 45 secs p rank
#define int long long
#define endl '\n'
#define all(v) v.begin(),v.end()
#define idc continue
#define itn int
#define I i
#define ,= <=
  • »
    »
    5 месяцев назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится
    #define endl '\n'
    

    really stops it from being anything but a disappointment

  • »
    »
    5 месяцев назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    in interactive problems

    should use endl it flushes automatically and personally $$$'\n'$$$ is more suitable for typing

  • »
    »
    4 недели назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    WARNING! WARNING! A FAN OF ULTRAKILL DETECTED! A FAN OF ULTRAKILL DETECDED!

  • »
    »
    4 недели назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится
    #define kira cout<<"My name is Yoshikage Kira.\nI'm 33 years old.\nMy house is in the northeast section of Morioh,\nwhere all the villas are, and I am not married.\nI work as an employee for the Kame Yu department stores,\nand I get home every day by 8 PM at the latest.\nI don't smoke, but I occasionally drink.\nI'm in bed by 11 PM,\nand make sure I get eight hours of sleep,\nno matter what.\nAfter having a glass of warm milk\nand doing about twenty minutes of stretches before going to bed,\nI usually have no problems sleeping until morning.\nJust like a baby, I wake up without any fatigue or stress in the morning.\nI was told there were no issues at my last check-up.\nI'm trying to explain that I'm a person who wishes to live a very quiet life.\nI take care not to trouble myself with any enemies,\nlike winning and losing, that would cause me to lose sleep at night.\nThat is how I deal with society, and I know that is what brings me happiness.\nAlthough, if I were to fight I wouldn't lose to anyone.";
    

    Take this!

»
7 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

I'd go for #define ll int

»
7 месяцев назад, скрыть # |
 
Проголосовать: нравится +9 Проголосовать: не нравится

I generally prefer doing something like using ll = long long; (actually, using ll = int64_t;) instead of #define ll long long because the later option doesn't admit functional style casts (in other words, long long (val) does not compile). Also, semantically speaking it is much nicer.

Additionally, #define int long long is quite evil from my perspective and I only use it in worst case scenarios. The reason why I don't appreciate it is that it admits laziness in terms of reasoning about types. Reasoning about types can often make you understand the problem and your solution better, which means that fixing bugs later on becomes easier (that is to say, if you have a better understanding, your code becomes more "maintainable" for you).

»
7 месяцев назад, скрыть # |
 
Проголосовать: нравится +8 Проголосовать: не нравится

I used to have this:

#define FOR1(a) for (ll _ = 0; _ < ll(a); ++_)
#define FOR2(i, a) for (ll i = 0; i < ll(a); ++i)
#define FOR3(i, a, b) for (ll i = ll(a); i < ll(b); ++i)
#define overload3(a, b, c, d, ...) d
#define FOR(...) overload3(__VA_ARGS__, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define RFOR1(a) for (ll _ = ll(a) - 1; _ >= 0; --_)
#define RFOR2(i, a) for (ll i = ll(a) - 1; i >= 0; --i)
#define RFOR3(i, a, b) for (ll i = ll(b) - 1; i >= ll(a); --i)
#define overload3_r(a, b, c, d, ...) d
#define RFOR(...) overload3_r(__VA_ARGS__, RFOR3, RFOR2, RFOR1)(__VA_ARGS__)

The usage is like:

FOR(n) // iterates n times
FOR(i, n) // iterates i = 0 to i = n-1
FOR(i, 1, n+1) // iteraties i = 1 to i = n

And you can use the same thing to iterate backwards by using RFOR. As it was not really a good practice, I stopped using it lol.

»
5 месяцев назад, скрыть # |
 
Проголосовать: нравится +14 Проголосовать: не нравится

The best one for me was:

#define victor vector<int>
»
5 месяцев назад, скрыть # |
← Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

The defines in this submission should be on S++ tier.

»
5 месяцев назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится
#define REP(i, a, b) for(int i = (a); i <= (b); i++)
#define PER(i, b, a) for(int i = (b); i >= (a); i--)

Когда-то мне нравились такие)

»
5 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Wait, no body uses typedef?

»
5 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

how can i get this ranking/order that you made,
when i click cf's image it has very few pixels.
when i click the tierlist link it is not ranked

»
5 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

One of my define:

#define fast_io ios_base::sync_with_stdio(false); cin.tie(0);

#define pb push_back

»
4 недели назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

No define :sunglasses:

»
4 недели назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

A tier

»
4 недели назад, скрыть # |
 
Проголосовать: нравится +26 Проголосовать: не нравится

#define _ << ' ' << where

»
4 недели назад, скрыть # |
 
Проголосовать: нравится -10 Проголосовать: не нравится

$$$#define vektor vector$$$

»
4 недели назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Captura-de-tela-2026-10-20-223053.

»
4 недели назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define sz(x) (int)x.size()
#define arr array
#define endl "\n"
#define pb emplace_back
#define ll long long
#define ld long double

Ig A-B tier, i do not really know.