Uva 11353 – A Different kind of Sorting

Problem Link Solution :- A Different kind of Sorting C++ /****************************************************************** *** Problem : *** *** Author : Shipu Ahamed (Psycho Timekiller) *** *** E-mail : shipuahamed01@gmail.com *** *** University : BUBT,Dept. of CSE *** *** Team : BUBT_Psycho *** *** My Blog : http://shipuahamed.blogspot.com *** *** Facebook : http://www.facebook.com/DeesheharaShipu *** ******************************************************************/ #include <stdio.h> #include <math.h> #include <stdlib.h> #include <string.h> #include <stack> #include <queue> #include <vector> #include <utility> #include <string> #include <sstream> #include <iostream> #include <set> #include <map> #include <algorithm> #include <memory.h> #include <functional> #include <numeric> #include <bits/stdc++.h> using namespace std; #define pi 2*acos(0.0) #define all(v) v.begin(),v.end() //input #define si(t) scanf("%d",&t) #define sl(t) scanf("%lld",&t) #define sf(t) scanf("%f",&t) #define sd(t) scanf("%lf",&t) #define sc(c) scanf("%c",&c) #define sii(a,b) scanf("%d%d",&a,&b) #define sll(a,b) scanf("%lld%lld",&a,&b) //Output #define P(a) printf("%dn",a) #define PL(a) printf("%lldn",a) #define PF(a) printf("%fn",a) #define PDB(a) printf("%lfn",a) #define PN(a) printf("%d ",a) #define PLN(a) printf("%lld ",a) #define PFN(a) printf("%f ",a) #define PDBN(a) printf("%lf ",a) #define PP(a,b) printf("%d %dn",a,b) #define PPN(a,b) printf("%d %d ",a,b) #define PPL(a,b) printf("%lld %lldn",a,b) #define PPLN(a,b) printf("%lld %lld ",a,b) #define CP(a) cout<<a<<endl #define CPN(a) cout<<a<<" " #define ff first #define se second #define pb push_back #define ppb pop_back #define mkp(a,b) make_pair(a,b) #define ST(v) sort(all(v)) #define sz(x) (int)x.size() #define gcd(a,b) __gcd(a,b) #define lcm(a,b) (a*(b/gcd(a,b))) #define max3(a,b,c) max(a,max(b,c)) #define min3(a,b,c) min(a,min(b,c)) #define maxall(v) *max_element(all(v)) #define minall(v) *min_element(all(v)) #define ms(a,n) memset(a, n, sizeof(a)) #define ms0(a) ms(a,0) #define amax(a,b) ( (a) = max( (a) , (b) ) ) #define amin(a,b) ( (a) = min( (a) , (b) ) ) #define sqr(a) ((a)*(a)) #define abs(x) (((x)<0)?-(x):(x)) #define cover(a,d) memset(a,d,sizeof(a)) #define popcount(i) __builtin_popcount(i) //count one #define parity(i) __builtin_parity(i) //evenparity 0 and odd parity 1 #define un(v) ST(v), (v).erase(unique(all(v)),v.end()) #define...

Lightoj 1054 – Efficient Pseudo Code

Problem Link Solution :- Efficient Pseudo Code C++ /****************************************************************** *** Problem : *** *** Author : Shipu Ahamed (Psycho Timekiller) *** *** E-mail : shipuahamed01@gmail.com *** *** University : BUBT,Dept. of CSE *** *** Team : BUBT_Psycho *** *** My Blog : http://shipuahamed.blogspot.com *** *** Facebook : http://www.facebook.com/DeesheharaShipu *** ******************************************************************/ #include <bits/stdc++.h> using namespace std; #define pi 2*acos(0.0) #define all(v) v.begin(),v.end() //input #define si(t) scanf("%d",&t) #define sl(t) scanf("%I64d",&t) #define sf(t) scanf("%f",&t) #define sd(t) scanf("%lf",&t) #define sc(c) scanf("%c",&c) #define sii(a,b) scanf("%d%d",&a,&b) #define sll(a,b) scanf("%I64d%I64d",&a,&b) //Output #define P(a) printf("%dn",a) #define PL(a) printf("%lldn",a) #define PF(a) printf("%fn",a) #define PDB(a) printf("%lfn",a) #define PN(a) printf("%d ",a) #define PLN(a) printf("%I64d ",a) #define PFN(a) printf("%f ",a) #define PDBN(a) printf("%lf ",a) #define PP(a,b) printf("%d %dn",a,b) #define PPN(a,b) printf("%d %d ",a,b) #define PPL(a,b) printf("%lld %lldn",a,b) #define PPLN(a,b) printf("%lld %lld ",a,b) #define CP(a) cout<<a<<endl #define CPN(a) cout<<a<<" " #define ff first #define se second #define pb push_back #define ppb pop_back #define mkp(a,b) make_pair(a,b) #define ST(v) sort(all(v)) #define sz(x) (int)x.size() #define gcd(a,b) __gcd(a,b) #define lcm(a,b) (a*(b/gcd(a,b))) #define max3(a,b,c) max(a,max(b,c)) #define min3(a,b,c) min(a,min(b,c)) #define maxall(v) *max_element(all(v)) #define minall(v) *min_element(all(v)) #define ms(a,n) memset(a, n, sizeof(a)) #define ms0(a) ms(a,0) #define amax(a,b) ( (a) = max( (a) , (b) ) ) #define amin(a,b) ( (a) = min( (a) , (b) ) ) #define sqr(a) ((a)*(a)) #define abs(x) (((x)<0)?-(x):(x)) #define cover(a,d) memset(a,d,sizeof(a)) #define popcount(i) __builtin_popcount(i) //count one #define parity(i) __builtin_parity(i) //evenparity 0 and odd parity 1 #define un(v) ST(v), (v).erase(unique(all(v)),v.end()) #define common(a,b) ST(a), ST(b), a.erase(set_intersection(all(a),all(b),a.begin()),a.end()) #define uncommon(a,b) ST(a), ST(b), a.erase(set_symmetric_difference(all(a),all(b),a.begin()),a.end()) typedef long long ll; typedef unsigned long long ull; typedef pair<int,int> pii; typedef pair<pii,int> piii; typedef pair<ll,ll> pll; typedef pair<string,int> psi; typedef vector<int> vi; typedef vector<ll> vll;...

LightOj 1278 – Sum of Consecutive Integers

Problem Link Solution :- Sum of Consecutive Integers C++ /****************************************************************** *** Problem No : Light oj - 1278 *** *** Problem Name : Sum of Consecutive Integers *** *** Type : Number theory *** *** Author : Shipu Ahamed (Psycho Timekiller) *** *** E-mail : shipuahamed01@gmail.com *** *** University : BUBT,Dept. of CSE *** *** Team : BUBT_Psycho *** *** Facebook : http://www.facebook.com/DeesheharaShipu *** ******************************************************************/ #include <bits/stdc++.h> using namespace std; #define pi 2*acos(0.0) #define all(v) v.begin(),v.end() //input #define si(t) scanf("%d",&t) #define sl(t) scanf("%lld",&t) #define sf(t) scanf("%f",&t) #define sd(t) scanf("%lf",&t) #define sc(c) scanf("%c",&c) #define sii(a,b) scanf("%d%d",&a,&b) #define sll(a,b) scanf("%I64d%I64d",&a,&b) //Output #define P(a) printf("%dn",a) #define PL(a) printf("%lldn",a) #define PF(a) printf("%fn",a) #define PDB(a) printf("%lfn",a) #define PN(a) printf("%d ",a) #define PLN(a) printf("%I64d ",a) #define PFN(a) printf("%f ",a) #define PDBN(a) printf("%lf ",a) #define PP(a,b) printf("%d %dn",a,b) #define PPN(a,b) printf("%d %d ",a,b) #define PPL(a,b) printf("%lld %lldn",a,b) #define PPLN(a,b) printf("%lld %lld ",a,b) #define CP(a) cout<<a<<endl #define CPN(a) cout<<a<<" " #define ff first #define se second #define pb push_back #define ppb pop_back #define mkp(a,b) make_pair(a,b) #define ST(v) sort(all(v)) #define sz(x) (int)x.size() #define gcd(a,b) __gcd(a,b) #define lcm(a,b) (a*(b/gcd(a,b))) #define max3(a,b,c) max(a,max(b,c)) #define min3(a,b,c) min(a,min(b,c)) #define maxall(v) *max_element(all(v)) #define minall(v) *min_element(all(v)) #define ms(a,n) memset(a, n, sizeof(a)) #define ms0(a) ms(a,0) #define amax(a,b) ( (a) = max( (a) , (b) ) ) #define amin(a,b) ( (a) = min( (a) , (b) ) ) #define sqr(a) ((a)*(a)) #define abs(x) (((x)<0)?-(x):(x)) #define cover(a,d) memset(a,d,sizeof(a)) #define popcount(i) __builtin_popcount(i) //count one #define parity(i) __builtin_parity(i) //evenparity 0 and odd parity 1 #define un(v) ST(v), (v).erase(unique(all(v)),v.end()) #define common(a,b) ST(a), ST(b), a.erase(set_intersection(all(a),all(b),a.begin()),a.end()) #define uncommon(a,b) ST(a), ST(b), a.erase(set_symmetric_difference(all(a),all(b),a.begin()),a.end()) typedef long long ll; typedef unsigned long long ull; typedef pair<int,int> pii;...