Sinux's blog

By Sinux, history, 9 days ago, In English

Since I am a newbie. I want to know how you guys practice solving problems. Do you guys practice by solving the problemset or by participating virtual contests? Any other advices are welcome.

Full text and comments »

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

By Sinux, history, 6 weeks ago, In English

Hi, I was practicing solving problems from USACO and I became curious when I saw the test data. The majority of the test data have surprisingly large numbers of test data. How are these test cases made? Do the problems maker calculate the output with these unusually large numbers of inputs?(Sorry for the bad english)

Full text and comments »

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

By Sinux, history, 2 months ago, In English

I am struggling on solving the problem 1873E problem div4. I wrote the solution but few test cases are wrong and I can't find the flaw in my code. Plz Help!!!

#include <algorithm>
#include <iostream> 
#include <vector> 
using namespace std;
#define ll long long
int main() {
    ll t;
    cin >> t;
    while (t--) {
        ll n, x;
        cin >> n >> x;
        vector<ll> a(n);
        for (int i = 0; i < n; i++) {
            cin >> a[i];
        }
        sort(a.begin(), a.end());
        ll left = 0, right = a[n - 1];
        ll height = 0;
        while (left <= right) {
            ll mid = (left + right) / 2;
            ll sum = 0;
            for (int i = 0; i < n; i++) {
                if (mid > a[i]) {
                    sum += mid - a[i];
                }
            }
            if (sum <= x) {
                height = mid;
                left = mid + 1;
            }
            else {
                right = mid - 1;
            }
        }
        cout << height << '\n'; 
    }

    return 0;
}

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By Sinux, history, 2 months ago, In English

void search(int k) { if (k == n) { // process subset } else { search(k+1); subset.push_back(k); search(k+1); subset.pop_back(); } }

I am having a really hard time understand this code. I especially don't understand how 'k' turns to 2 after 'k' reaches 3. I don't understand because there's no such code that does search(k-1) but it backtracks automatically. I think It's related to the thing backtracking. Someone plz help!!!

Full text and comments »

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

By Sinux, history, 3 months ago, In English

Should I practice CP by problems rating or by algorithm topics?

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By Sinux, history, 3 months ago, In English

Hi, I am curious. At what age do successful competitive programmers such as IOI gold medal winners start CP?

Full text and comments »

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

By Sinux, history, 3 months ago, In English

Hey guys, I just started CP. I am able to solve 800 rated problems very easily but find 900 rated problems hard(especially number theory or math problems). I am currently in 8th grade and studying algebra 1. I am curious if the lack of my high school math skill is the reason solving 900 rated problems very hard.

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it