TheGhostOfTsushima's blog

By TheGhostOfTsushima, history, 10 months ago, In English

Hello friends,

I am very eager to share one GUI tool that I created a few months ago, which I think helped me train better. The whole Idea was actually inspired by the book Atomic Habits, where if you keep doing the same thing regularly as a habit, it will become organically and exponentially increase your skill level. And to facilitate this process, you need habit tracking and a Goldilocks zone (practicing problems with a rating range near your current level). However, as Codeforces contests are not held every day, you may want to see your rating is getting updated live. This will make the training process addictive and give dopamine feedback. I have uploaded it to GitHub so that more people can use it.

The idea of Eloforces

This is a GUI app that will run locally on your computer. You can put your Handle there, that will load/store your virtual rating. Virtual Rating is basically your imaginary rating inside that app that will adjust to your level as you keep using the application. If you click on the "Match Problem" button, it will give you a problem from Codeforces that you didn't solve before. If you can complete the problem within time and click on submit button there it will update your rating.

Link: EloForces — GitHub

Feedback

I am eager to implement new features if I think it's necessary and if any bug fix is required. Feel free to create issue in the repo there.

Full text and comments »

  • Vote: I like it
  • +1
  • Vote: I do not like it

By TheGhostOfTsushima, history, 13 months ago, In English

Recently I'm getting "unexpected error" while submitting solution to a problem. Tried with different browsers but same things happen there too. The screenshot is here:-

Full text and comments »

  • Vote: I like it
  • +39
  • Vote: I do not like it

By TheGhostOfTsushima, history, 15 months ago, In English

Hey everyone!

I recently built a neat wrapper around GNU PBDS's ordered multiset to simplify operations like:

  • Counting how many elements are <, <=, >, or >= a value
  • Range frequency queries like [l, r], (l, r], etc.
  • Accessing the k-th smallest element (0-based) with [] operator

It's named SortedArray, and it makes these operations intuitive using operator overloading.

Use the code below and make sure you have ordered_set included from PBDS,

class SortedArray {
    ordered_multiset arr;
public:
    long long size() { return arr.size(); }
    void operator += (long long x) { arr.insert(x); } 
    long long operator < (long long x) { return arr.order_of_key(x); }
    long long operator <= (long long x) { return arr.order_of_key(x+1); }
    long long operator > (long long x) { return arr.size() - arr.order_of_key(x+1); }
    long long operator >= (long long x) { return arr.size() - arr.order_of_key(x); }
    long long LR(long long l, long long r) { return max((*this <= r) - (*this < l), 0LL); }
    long long lR(long long l, long long r) { return LR(l+1, r); }
    long long Lr(long long l, long long r) { return LR(l, r-1); }
    long long lr(long long l, long long r) { return LR(l+1, r-1); }
    long long operator [] (long long i) { return *arr.find_by_order(i); }
};

Here’s how it works in practice:

SortedArray sa;

sa += 5;
sa += 10;
sa += 5;

cout << sa.size() << "\n";     // 3

cout << (sa < 6) << "\n";      // 2 (number of elements < 6)
cout << (sa <= 5) << "\n";     // 2
cout << (sa > 5) << "\n";      // 1
cout << (sa >= 10) << "\n";    // 1

cout << sa[1] << "\n";         // 5 (element at index 1)

cout << sa.LR(5, 10) << "\n";  // 3 (in [5, 10])
cout << sa.lR(5, 10) << "\n";  // 1 (in (5, 10])
cout << sa.Lr(5, 10) << "\n";  // 2 (in [5, 10))
cout << sa.lr(5, 10) << "\n";  // 0 (in (5, 10))

Let me know what you think! Hope it helps you

Full text and comments »