//yuki789.cpp //Wed Jan 8 20:11:42 2020 #include #include #include #include #include #include #include #include #include #define INTINF 2147483647 #define LLINF 9223372036854775807 using namespace std; using ll=long long; typedef pair P; ll nodenum,seg[800000]; void init(ll n){ nodenum = 1; while (nodenum0){ index = (index-1)/2; seg[index] = seg[index*2+1]+seg[index*2+2]; } } ll query(ll a, ll b, ll k, ll l, ll r){ if (b<=l || r<=a){ return 0; } if (a<=l && r<=b){ return seg[k]; }else { ll v1 = query(a,b,k*2+1,l,(l+r)/2); ll v2 = query(a,b,k*2+2,(l+r)/2,r); return v1+v2; } } int main(){ ll n; cin >> n; ll q[n],x[n],y[n]; vector pos; for (int i=0;i> q[i] >> x[i] >> y[i]; pos.push_back(x[i]); pos.push_back(y[i]); } sort(pos.begin(),pos.end()); pos.erase(unique(pos.begin(),pos.end()),pos.end()); map mpfor; for (ll i=0;i