StellarSpecter's blog

By StellarSpecter, history, 17 hours ago, In English

What did I do to deserve so many downvotes on each and every thing I have posted comments, blogs, etc.

When i ask questions -> I get downvoted. I ask for tips -> I get downvoted.

I checked, I'm the 35th lowest rated with -62 on the whole platform. :(((

Please STOP this ratism.

Full text and comments »

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

By StellarSpecter, history, 19 hours ago, In English

I solved it as if y<0 and abs(y) >= abs(x) cout<<"NO"<<endl;

But this did not work even after trying so long.

why is this incorrect can anyone help this newbie?

THANKS!

Full text and comments »

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

By StellarSpecter, history, 3 days ago, In English

I SOLVED PROBLEM C IN TODAY"S DIV.2 :((((

WHY MY RATING IS STILL SAME WHILE FOR EVERYONE ELSE THERE IS A DELTA>0

Full text and comments »

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

By StellarSpecter, history, 3 days ago, In English

Help me solve this problem please ->

**** **** There is an array of n elements, initially filled with zeros. You need to write a data structure that processes two types of queries: assign value v to all elements on the segment from l to r−1, find the sum on the segment from l to r−1.

Input

The first line contains two numbers n and m (1≤n, m≤100000), the size of the array and the number of operations. The following lines contain the description of the operations. The description of each operation is as follows: 1 l r v: assign value v to all elements on the segment from l to r−1 (0≤l<r≤n, 0≤v≤109). 2 l r: find the sum on the segment from l to r−1 (0≤l<r≤n).

Output

For each operation of the second type, print the corresponding value.

Full text and comments »

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

By StellarSpecter, history, 3 days ago, In English

There is an array of n elements, initially filled with zeros. You need to write a data structure that processes two types of queries:

add v to the segment from l to r-1, find the sum on the segment from l to r−1.

Input The first line contains two numbers n and m (1≤n,m≤100000), the size of the array and the number of operations. The following lines contain the description of the operations. The description of each operation is as follows:

1 l r v: add v to the segment from l to r−1 (0≤l<r≤n, 0≤v≤105). 2 l r: find the sum on the segment from l to r−1 (0≤l<r≤n).

Output For each operation of the second type, print the corresponding value.

My Code:

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD=1e9+7;

const int N = 1e5;
ll seg_tree[4*N];
ll lazy[4*N];

void push(int l, int r, int node){
    if(l!=r&&lazy[node]!=0){
        int m = l + (r-l)/2;
        seg_tree[2*node]+=(m-l+1)*lazy[node];
        seg_tree[2*node+1]+=(r-m)*lazy[node];
        lazy[2*node+1]+=lazy[node];
        lazy[2*node]+=lazy[node];
        lazy[node]=0;
    }
}

void update(int l, int r, int i, int j, int val, int node){
    if(i>r||j<l) return;                    // OR l>r
    if(i<=l&&j>=r){
        seg_tree[node]+=(r-l+1)*val;
        lazy[node]+=val;
        return;
    }
    push(l,r,node);
    int m = (l+r)/2;
    update(l,m,i,min(j,m),val,2*node); update(m+1,r,max(i,m+1),j,val,2*node+1);
    seg_tree[node]=seg_tree[2*node]+seg_tree[2*node+1];
}

ll query(int l, int r, int i, int j, int node){
    if(i>r||j<l) return 0;
    if(l>=i&&r<=j){             // OR if(l>=i&&r<=j) returns seg_tree[node];    -> both are correct.
        return seg_tree[node];
    }
    push(l,r,node);
    int m = (l+r)/2;
    return query(l,m,i,min(j,m),2*node) + query(m+1,r,max(i,m+1),j,2*node+1);
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n,m; cin>>n>>m;
    while(m--){
        int t; cin>>t;
        if(t==1){
            int i,j,v; cin>>i>>j>>v;
            update(0,n-1,i,j-1,v,1);
        }
        else{
            int i,j; cin>>i>>j;
            cout<<query(0,n-1,i,j-1,1)<<'\n';
        }
    }
}

24 hours and couldn't figure out what's wrong in my code. Can anyone help me decode what's wrong with my solution ? I'm getting wrong answer on test case 61 with '!' symbol.

Full text and comments »

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

By StellarSpecter, history, 8 days ago, In English

I bet it's too hard for you to solve.

Go give it a try:

SMASH ME

Full text and comments »

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

By StellarSpecter, history, 12 days ago, In English

If you can give some tips/advice it would be really helpful.

I suck at problem solving and i get tired of solving the same problem over and over again and in the end i quit.

thanks in advance for the tips.

Full text and comments »

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

By StellarSpecter, history, 2 weeks ago, In English

How is it possible?

Everyone's rating change has been made but my rating is still the same and it shows not even +0 in the contest rating change page.

Full text and comments »

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

By StellarSpecter, history, 2 weeks ago, In English

Even after trying so hard in today's Div.4 I couldn't solve a single good problem.

Conclusion: I'm the problem.

Goodbye Cf, it's not for retards like me.

Full text and comments »

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