-
Notifications
You must be signed in to change notification settings - Fork 3
/
template.cpp
126 lines (106 loc) · 3.64 KB
/
template.cpp
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
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
121
122
123
124
125
126
/*
Problem Link :
Solved By : Kazi Mahbubur Rahman (iamcrypticcoder)
Status : [AC, WA, TLE, RTE]
Time :
Rank :
Complexity:
*/
#define _CRT_SECURE_NO_WARNINGS
#include <set>
#include <map>
#include <list>
#include <cmath>
#include <ctime>
#include <queue>
#include <stack>
#include <cctype>
#include <cstdio>
#include <string>
#include <vector>
#include <cassert>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <iostream>
#include <climits>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
using namespace std;
#define FOR(i, L, U) for(int i=(int)L; i<=(int)U; i++)
#define FORD(i, U, L) for(int i=(int)U; i>=(int)L; i--)
#define READ(x) freopen(x, "r", stdin)
#define WRITE(x) freopen(x, "w", stdout)
#define ff first
#define ss second
#define PQ priority_queue
#define PB push_back
#define SZ size()
#define SQR(x) ((x)*(x))
#define ALL_BITS ((1 << 31) - 1)
#define NEG_BITS(mask) (mask ^= ALL_BITS)
#define TEST_BIT(mask, i) (mask & (1 << i))
#define ON_BIT(mask, i) (mask |= (1 << i))
#define OFF_BIT(mask, i) (mask &= NEG_BITS(1 << i))
#define IS_POWER_TWO(x) (x && !(x & (x-1)))
#define OFF_RIGHTMOST_SET_BIT(x) (x & (x-1))
typedef unsigned int uint;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PII;
typedef pair<uint, uint> PUU;
typedef pair<double, double> PDD;
typedef vector<bool> VB;
typedef vector<int> VI;
typedef vector<uint> VU;
typedef vector<double> VD;
typedef vector<char> VC;
typedef vector<string> VS;
typedef map<int, int> MII;
typedef map<uint, uint> MUU;
typedef map<char, int> MCI;
typedef map<string, int> MSI;
typedef vector<vector<bool> > VVB;
typedef vector<vector<int> > VVI;
typedef vector<vector<double> > VVD;
typedef vector<vector<PII> > VVPII;
int allBits() { return ((1 << 31) - 1); }
int negBits(int n) { return n ^ ((1 << 31) - 1); }
bool checkBit(int n, int i) { return (n & (1 << i)); }
int setBit(int n, int i) { return (n | (1 << i)); }
int clearBit(int n, int i) { return (n & ~(1 << i)); }
int flipBit(int n, int i) { return (n ^ (1 << i)); }
bool isPower2(int n) { return (n && !(n & (n-1))); }
long long GCD(long long a, long long b) { while (b)b ^= a ^= b ^= a %= b; return a; }
long long LCM(long long a, long long b) { return a / GCD(a, b) * b; }
// UP, RIGHT, DOWN, LEFT, UPPER-RIGHT, LOWER-RIGHT, LOWER-LEFT, UPPER-LEFT
int dx[8] = { -1, 0, 1, 0, -1, 1, 1, -1 };
int dy[8] = { 0, 1, 0,-1, 1, 1, -1, -1 };
// Represents all moves of a knight in a chessboard
int dxKnightMove[8] = { -1, -2, -2, -1, 1, 2, 2, 1 };
int dyKnightMove[8] = { 2, 1, -1, -2, -2, -1, 1, 2 };
// Input Methods
inline int srcInt() { int ret; scanf("%d", &ret); return ret; }
inline uint srcUInt() { uint ret; scanf("%u", &ret); return ret; }
inline LL srcLongLong() { long long ret; scanf("%lld", &ret); return ret; }
inline ULL srcULongLong() { unsigned long long ret; scanf("%llu", &ret); return ret; }
const char WHITE = 0;
const char GRAY = 1;
const char BLACK = 2;
const int INF = int(1e9);
const double EPS = double(1e-9);
const double TO_DEG = double(57.29577951);
const double PI = 2*acos(0.0);
const int MAX_N = int(1e5);
int main() {
//READ("../input.txt");
//WRITE("output.txt");
int i, j, k;
uint TC, tc;
double cl = clock();
// Start your code here
cl = clock() - cl;
fprintf(stderr, "Total Execution Time = %lf seconds\n", cl / CLOCKS_PER_SEC);
return 0;
}