-
Notifications
You must be signed in to change notification settings - Fork 3
/
util.hpp
54 lines (51 loc) · 1.25 KB
/
util.hpp
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
/*
* util.hpp
*
* Created on: 24/12/2013
* Author: polymorpher
*/
#pragma once
#include<vector>
#include<random>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<ctime>
#include<unistd.h>
#include<cassert>
#include<google/dense_hash_map>
#include<memory>
#include<thread>
#include<sstream>
#define __DEBUG
#define CLOG(X) if(__DEBUG)printf(X)
typedef std::vector<std::vector<int> > Vector2DInt;
typedef std::vector<std::vector<double> > Vector2DDouble;
typedef std::vector<std::vector<long double> > Vector2DLongDouble;
typedef std::vector<int> VecInt;
typedef std::vector<double> VecDouble;
typedef std::vector<long double> VecLongDouble;
typedef google::dense_hash_map<int,int> MapIntInt;
typedef google::dense_hash_map<int,double> MapIntDouble;
typedef std::vector<MapIntInt> VecMapIntInt;
typedef std::vector<MapIntDouble> VecMapIntDouble;
inline void vecResize2D(Vector2DInt &a, int s0, int s1) {
a.resize(s0);
for (size_t i = 0; i < a.size(); i++) {
a[i].resize(s1);
}
}
inline void vecResize2D(Vector2DDouble &a, int s0, int s1) {
a.resize(s0);
for (size_t i = 0; i < a.size(); i++) {
a[i].resize(s1);
}
}
template<class T> T convertString(std::string s){
std::stringstream ss;
ss<<s;
T t;
ss>>t;
return t;
}