Reminder: in case of any technical issues, you can use the lightweight website m1.codeforces.com, m2.codeforces.com, m3.codeforces.com. ×

MinusRatingPhobia's blog

By MinusRatingPhobia, history, 2 months ago, In English
int lis(vector<int> &a) {
    int n = a.size();
    const int INF = 1e9 + 1;
    vector<int> d(n+1, INF);
    d[0] = -INF;

    for (int i = 0; i < n; i++) {
        int j = upper_bound(d.begin(), d.end(), a[i]) - d.begin();
        if (d[j-1] < a[i] && a[i] < d[j])
            d[j] = a[i];
    }

    int ans = 0;
    for (int i = 0; i <= n; i++) {
        if (d[i] < INF)
            ans = i;
    }

    for(int i = 1;i <= ans; i++){
        cout<<d[i]<<" ";
    }
    return ans;
}

Read more »

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

By MinusRatingPhobia, history, 2 months ago, In English

Hi All, I was wondering how can we check whether a number is prime or not if it is let's say a 30 digit number. I am trying to solve this for few days now I would really appreciate help of any sort. Thank you.

Read more »

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