always_4ever_5_25__21_SS's blog

By always_4ever_5_25__21_SS, history, 7 years ago, In English

I am trying to solve Sereja and Brackets . I can see that n is up to 10^6. And I have seen others solutions and they are pretty much as same as mine. I cannot figure out why I am getting TLE for my submission. Cannot find anything wrong with my segment tree or if I have missed something. :(

This is my submission. 37125846

Full text and comments »

By always_4ever_5_25__21_SS, history, 7 years ago, In English

#include<bits/stdc++.h> using namespace std; typedef long long LL ; vector <LL> v[100]; vector <LL> v1; int main(){ cout << v[1].size() - 1 << endl; //This gives output 4294967295 int sz = v[1].size() - 1; cout << sz << endl; //This gives output -1 LL sz1 = v[1].size() - 1; cout << sz1 << endl; //This gives output 4294967295 cout << v[1].size() << endl; //This gives output 0 cout << v1.size() - 1 << endl; //This gives output 4294967295 cout << v1.size() << endl; //This gives output 0 }

Can anyone give any explanation? I lost a lot of valuable time in the contests for these stuffs and I can't understand why.

Full text and comments »

By always_4ever_5_25__21_SS, history, 7 years ago, In English
  1. 33592102
  2. 33592281

In my first submission, I used lower_bound to find the index I want to erase. In my second one, I implement the same idea using ook (order_of_key) and fbk (find_by_order) of ordered_set. My first submission resulted in TLE (time limit 2 sec) where my second submission passed on 233 ms. I don't see any algorithmic difference. Overall Complexity for Worst case O ( n * (logn) * (logn) ). Anyone can point out what I am missing or if I am wrong?

I faced the same thing when I solved CF round 450 div2 C: Remove Extra one. Using the build in lower_bound, I got TLE but got AC when I used ook.

N.B: In my above code, lowerBound() is a user made function. lower_bound() and lowerBound() is different.

Full text and comments »

By always_4ever_5_25__21_SS, history, 9 years ago, In English

OK, so i didn't get what the tutorial of that really meant, and that tutorial looked long..-_-

Fortunately, I found a better solution. And my solution is mainly like 2 lines!!! :p I think it's better if you see the code rather than me trying to explain it.....

include<bits/stdc++.h>

using namespace std;

int main(){ int n, i; cin>>n; for(i=0;i<n;i++)cout<<i+n*10<<" "; return 0; }

For any question or suggestion, feel free!!!

Full text and comments »