Sie sind auf Seite 1von 2

F:\Moje\Macro-Collection.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60

Mon, 14 March 2016 10:42 AM

//If you have a C++ compiler, try using this:


#include <bits/stdc++.h>
//This one statement includes ALL the standard libraries.
//One single #include, and then you can begin with the main program.
// Shortcuts for "common" data types
typedef long long
ll;
typedef vector<int>
vi;
typedef pair<int, int>
ii;
typedef vector<ii>
vii;
typedef set<int>
si;
typedef map<string, int>
msi;
/*

OR

*/

#define
#define
#define
#define
#define

ll long long
ull unsigned long long
ui unsigned int
us unsigned short
IOS ios_base::sync_with_stdio(0);
//to synchronize the input of cin and scanf
#define INF 1001001001
#define PI 3.1415926535897932384626
// To simplify repetitions/loops,
// Note: define your loop style and stick with it through out!

#define REP(i, a, b) \
for (int i = int(a); i <= int(b); i++) // a to b, and variable i is local!
#define TRvi(c, it) \
for (vi::iterator it = (c).begin(); it != (c).end(); it++)
#define TRvii(c, it) \
for (vii::iterator it = (c).begin(); it != (c).end(); it++)
#define TRmsi(c, it) \
for (msi::iterator it = (c).begin(); it != (c).end(); it++)
#define INF 2000000000 // 2 billion
// If you need to recall how to use memset:
#define MEMSET_INF 127 // about 2B
#define MEMSET_HALF_INF 63 // about 1B
memset(dist, MEMSET_INF, sizeof dist);
// useful to initialize shortest path distances
memset(arr, 0, sizeof arr); // useful to clear array of integers

// Another approach, to simplify loops and bits...


using namespace std;
#define bit(x,i) (x&(1<<i)) //select the bit of position i of x
#define lowbit(x) ((x)&((x)^((x)-1))) //get the lowest bit of x
#define hBit(msb,n) asm("bsrl %1,%0" : "=r"(msb) : "r"(n))
//get the highest bit of x, maybe the fastest
#define max(a,b) (a<b?b:a)
#define abs(x) (x<0?(-x):x) // big bug if "-x" is not surrounded by "()"
#define IN(i,l,r) (l<i&&i<r)

-1-

F:\Moje\Macro-Collection.h

61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120

Mon, 14 March 2016 10:42 AM

//the next for are for checking bound


#define LINR(i,l,r) (l<=i&&i<=r)
#define LIN(i,l,r) (l<=i&&i<r)
#define INR(i,l,r) (l<i&&i<=r)
//next four are for "for loops"
#define F(i,L,R) for (int i = L; i < R; i++)
#define FE(i,L,R) for (int i = L; i <= R; i++)
#define FF(i,L,R) for (int i = L; i > R; i--)
#define FFE(i,L,R) for (int i = L; i >= R; i--)
// next are handy ways to get ints, it also forces you to use '&' sign
#define getI(a) scanf("%d", &a)
#define getII(a,b) scanf("%d%d", &a, &b)
#define getIII(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define wez(n) int (n); scanf("%d",&(n))
//handy if the input is right after the definition of a variable
#define wez2(n,m) int (n),(m); scanf("%d %d",&(n),&(m))
#define wez3(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k))
#define TESTS wez(testow)while(testow--) //for multilple cases problems
#define whileZ int T; getI(T); while(T--) // the same as above
#define getS(x) scanf("%s", x) //get a char* string
#define clr(a,x) memset(a,x,sizeof(a)) //set elements of array to some value
#define
#define
#define
#define
#define

char2Int(c) (c-'0')
lastEle(vec) vec[vec.size()-1]
SZ(x) ((int)((x).size()))
REMAX(a,b) (a)=max((a),(b)) // set a to the maximum of a and b
REMIN(a,b) (a)=min((a),(b));

#define ALL(c) (c).begin(),(c).end() //handy for function like "sort()"


#define PRESENT(c,x) ((c).find(x) != (c).end())
#define CPRESENT(c,x) (find(ALL(c),x) != (c).end())
//for map,
#define mp
#define fi
#define se

pair
make_pair
first
second

// for debug
inline void pisz(int n) { printf("%d\n",n); }
#define DBG(vari) cerr<<#vari<<" = "<<(vari)<<endl;
#define printA(a,L,R) FE(i,L,R) cout << a[i] << (i==R?'\n':' ')
#define printV(a) printA(a,0,a.size()-1)
#define MAXN 10000
//for vectors
#define pb push_back
typedef int elem_t;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> ii;
/*---- [EOF]------------------[EOF]----------------

-2-

*/

Das könnte Ihnen auch gefallen