Advertisement
Guest User

Untitled

a guest
Mar 26th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.05 KB | None | 0 0
  1. /***************************************************DarkdreamOFmy**********************************************************/
  2. #include <string>
  3. #include <vector>
  4. #include <map>
  5. #include <list>
  6. #include <iterator>
  7. #include <set>
  8. #include <queue>
  9. #include <iostream>
  10. #include <sstream>
  11. #include <stack>
  12. #include <deque>
  13. #include <cmath>
  14. #include <memory.h>
  15. #include <cstdlib>
  16. #include <cstdio>
  17. #include <cctype>
  18. #include <algorithm>
  19. #include <utility>
  20. #include <assert.h>
  21. #include <time.h>
  22. #include <fstream>
  23. #include <sys/stat.h>
  24. #include <stdlib.h>
  25. #include <stdio.h>
  26. using namespace std;
  27.  
  28. typedef long int li;
  29. typedef long long int lli;
  30. typedef unsigned long long int ull;
  31. typedef signed long long int sll;
  32. typedef long double lld;
  33. typedef vector<int>vi;
  34. typedef vector<long>vl;
  35. typedef vector<long long int>vll;
  36. typedef vector<double>vd;
  37. typedef vector<long double>vld;
  38. typedef vector<char>vc;
  39. typedef vector<string>vs;
  40. typedef pair<int,int>pii;
  41. typedef pair<long long,long long>pll;
  42. typedef pair<double,double>pdd;
  43. typedef pair<char,char>pcc;
  44. typedef pair<string,string>pss;
  45. typedef map<int,int>mii;
  46. typedef map<long long,long long>mll;
  47. typedef map<char,char>mcc;
  48. typedef map<string,string>mss;
  49. typedef map<string,int>msi;
  50. typedef map< int,vector<int> >miv;
  51. typedef map<vector<int>,vector<int> >mvvi;
  52. typedef map<string,vector<int> >msv;
  53. typedef set<int>si;
  54. typedef set<string>ss;
  55. typedef set<vector<int> >sv;
  56. typedef queue<int>qi;
  57. typedef queue<long long>qll;
  58. typedef queue<string>qs;
  59. typedef stack<int>stki;
  60. typedef stack<long long>stkll;
  61.  
  62. /**-------------------END OF typedef------------------------------**/
  63.  
  64.  
  65. const int INF = 1000000000;
  66. const int MAX = 4007;
  67. const int MAX2 = 1000000;
  68. const int MAXD = 20;
  69. const int BASE = 1000000007;
  70. const int MOD = 1000000007;
  71. const int psz = 2000006;
  72.  
  73.  
  74. /**-------------------Constant int--------------------------------**/
  75.  
  76. #define scanI(a) scanf("%d",&a)
  77. #define scanI2(a,b) scanI(a) , scanI(b)
  78. #define scanI3(a,b,c) scanI(a), scanI(b), scanI(c)
  79. #define scanI4(a,b,c,d) scanI(a), scanI(b), scanI(c), scanI(d)
  80.  
  81. #define scanL(a) scanf("%lld",&a)
  82. #define scanL2(a,b) scanL(a) , scanL(b)
  83. #define scanL3(a,b,c) scanL(a), scanL(b), scanL(c)
  84. #define scanL4(a,b,c,d) scanL(a), scanL(b), scanL(c), scanL(d)
  85.  
  86. #define printI(a) printf("%d",a)
  87. #define printI2(a,b) printI(a) , printI(b)
  88. #define printI3(a,b,c) printI(a),printI(b),printI(c)
  89. #define printI4(a,b,c,d) printI(a),printI(b),printI(c),printI(d)
  90.  
  91. #define printL(a) printf("%lld",a)
  92. #define printL2(a,b) printL(a) , printL(b)
  93. #define printL3(a,b,c) printL(a),printL(b),printL(c)
  94. #define printL4(a,b,c,d) printL(a),printL(b),printL(c),printL(d)
  95.  
  96. /**----------------------Scan and print end--------------------------**/
  97.  
  98. #define min3(a,b,c) min(a,min(b,c))
  99. #define max3(a,b,c) max(a,max(b,c))
  100. #define min4(a,b,c,d) min(min(a,b),min(c,d))
  101. #define max4(a,b,c,d) max(max(a,b),max(c,d))
  102. #define max5(a,b,c,d,e) max(max3(a,b,c),max(d,e))
  103. #define min5(a,b,c,d,e) min(min3(a,b,c),min(d,e))
  104.  
  105. /**----------------------MAX and MIN end-----------------------------**/
  106.  
  107. #define fst first
  108. #define snd second
  109. #define all(a) a.begin(),a.end()
  110. #define rall(a) a.rbegin(),a.rend()
  111. #define SQR(a) ((a)*(a))
  112. #define Unique(a) sort(all(a)),a.erase(unique(all(a)),a.end())
  113. #define Iterator(a) __typeof__(a.begin())
  114. #define rIterator(a) __typeof__(a.rbegin())
  115. #define FORI(a,it) for(Iterator(a) it = a.begin();it != a.end(); it++)
  116. #define RFORI(a,it) for(rIterator(a) it = a.rbegin();it != a.rend(); it++)
  117. #define FOR(i, a, b) for(int i=(a);i<(b);i++)
  118. #define RFOR(i, b, a) for(int i=(b)-1;i>=(a);--i)
  119. #define FILL(A,value) memset(A,value,sizeof(A))
  120. #define SZ(V) (int)V.size()
  121. #define PB push_back
  122. #define MP make_pair
  123. #define Pi 3.14159265358979
  124. #define read(x) freopen(x, "r", stdin)
  125. #define write(x) freopen(x, "w", stdout)
  126.  
  127. /**---------------------End of define of all----------------------**/
  128.  
  129.  
  130. int fx[]= {+0,+0,+1,-1,-1,+1,-1,+1};
  131. int fy[]= {-1,+1,+0,+0,+1,+1,-1,-1};
  132.  
  133. int dx[]= {1,-1,0,0};
  134. int dy[]= {0,0,1,-1};
  135.  
  136. /**-----------------------Directional------------------------------**/
  137.  
  138. int chToIn(char a) {int b;b = a-'0';return b;}
  139. int stToIn(string a) {int b;b=atoi(a.c_str());return b;}
  140. string appendChar(string s,char a) {s.append(1,a);return s;}
  141. int gcd(int a, int b) {return (b == 0 ? a : gcd(b, a % b)); }
  142. int lcm(int a, int b) {return (a * (b / gcd(a, b))); }
  143. string rev(string a) {int siz=SZ(a);string res="";RFOR(i,siz,0){res+=a[i];}return res;}
  144.  
  145. /**---------------------End of functions--------------------------**/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement