Posts

Showing posts from October, 2016

SPOJ BUGLIFE (2SAT Basic/Bipartite Checking)

SPOJ BUGLIFE (2SAT Basic/Bipartite Checking) // /==================================================/// // / HELLO WORLD !! /// // / IT'S ME /// // / BISHAL GAUTAM /// // / [ bsal.gautam16@gmail.com ] /// // /==================================================/// #include<bits/stdc++.h> # define X first # define Y second # define mpp make_pair # define nl printf("\n") # define SZ ( x ) (int)(x.size()) # define pb ( x ) push_back(x) # define pii pair<int,int> # define pll pair<ll,ll> // /--------------------- # define S ( a ) scanf("%d",&a) # define P ( a ) printf("%d",a) # define SL ( a ) scanf("%lld",&a) # define S2 ( a , b ) scanf("%d%d",&a,&b) # define SL2 ( a , b ) scanf("%lld%lld",&a,&b) // /-------------------------------

CF:Gym problem-G ( Digit DP )

CF:Gym problem-G ( Digit DP ) Accoring to problem, You have given interval L,R. You have to print number which have maximum product of the digits. Idea: Digit DP storing state of 1. Position-p 2. flag for did I take small (chhoto)-ch 3.flag for did I take large(boro)-br 4.flag for statting of nonzero val-z // /==================================================/// // / HELLO WORLD !! /// // / IT'S ME /// // / BISHAL GAUTAM /// // / [ bsal.gautam16@gmail.com ] /// // /==================================================/// #include<bits/stdc++.h> # define X first # define Y second # define mpp make_pair # define nl printf("\n") # define SZ ( x ) (int)(x.size()) # define pb ( x ) push_back(x) # define pii pair<int,int> # define pll pair<ll,ll> // /--------------------- # define S ( a ) sca

CF: EduRound10: Nested Segments(data structure)

CF: EduRound10: Nested Segments(data structure)     Idea: We have to find total segments withing main segment, For this if we sort segments on the basis of which ends  earlier comes first, we may easily get answer by updating starting points withing segment range using BIT.     // /==================================================/// // / HELLO WORLD !! /// // / IT'S ME /// // / BISHAL GAUTAM /// // / [ bsal.gautam16@gmail.com ] /// // /==================================================/// #include<bits/stdc++.h> # define X first # define Y second # define mpp make_pair # define nl printf("\n") # define SZ ( x ) (int)(x.size()) # define pb ( x ) push_back(x) # define pii pair<int,int> # define pll pair<ll,ll> // /--------------------- # define S ( a ) scanf("%d",&a) # define P ( a ) printf(&