#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include typedef long long ll; using namespace std; #ifndef LOCAL #define debug(x) ; #else #define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl; template ostream &operator<<(ostream &out, const pair &p) { out << "{" << p.first << ", " << p.second << "}"; return out; } template ostream &operator<<(ostream &out, const vector &v) { out << '{'; for (const T &item : v) out << item << ", "; out << "\b\b}"; return out; } #endif #define mod 1000000007 //1e9+7(prime number) #define INF 1000000000 //1e9 #define LLINF 2000000000000000000LL //2e18 #define SIZE 3010 /* Starry Sky Tree */ //0-index struct StarrySkyTree{ typedef ll Type; int segn2; vector data, s_data; function merge; StarrySkyTree(function merge, int n): merge(merge) { for(segn2=1; segn2 ele[SIZE]; cin >> N >> M >> K; for(int i=0;i> l >> r; ele[i] = {l-1, r-1}; } sort(ele, ele + M); StarrySkyTree seg(N); seg.add(0, 1, 1); for(int i=0;i