#include <bits/stdc++.h>
using namespace std;
struct cust{
int st;
int en;
int p;
};
int main() {
ios::sync_with_stdio(0);
cin.tie(NULL);
int t;
cin>>t;
while(t--){
int n,k;
cin>>n>>k;
map<int,int> m;
cust a[(int)1e5+2];
for(int i=0;i<n;i++){
int x,y,z;
cin>>x>>y>>z;
a[i]={x,y,z};
}
sort(a,a+n,[](auto x,auto y){
return x.en<y.en;
});
int i=0,count=0;
for(int i=0;i<n;i++){
if(m[a[i].p]<=a[i].st){
m[a[i].p]=a[i].en;
count++;
}
}
cout<<count<<'\n';
}
return 0;
}
Comments
Post a Comment