structst { int lef; int rig; booloperator<(const st &tmp) const { returnthis->rig < tmp.rig; } } st[N];
intmain(){ int n; cin >> n; //别忘了输入n Qwq for (int i = 0; i < n; i++) { cin >> st[i].lef >> st[i].rig; } sort(st, st + n); int max = -2e9; int res = 0; for (int i = 0; i < n; i++) { if (st[i].lef > max) { max = st[i].rig; res++; } } cout << res << endl; }