I题不用multiset直接用set也能过,建议强化数据。本来不能过的代码:
#include <iostream>
#include <cstring>
#include <algorithm>
#include <set>

using namespace std;

const int N = 100010;

struct Point{
    int x,y,z;
    bool operator<(const Point &a) const
    {
        if(x != a.x) return x < a.x;
        if(y != a.y) return y < a.y;

        return z < a.z; 
    }
};

int n;
Point p[N];

int main()
{
    //freopen("data.in","r",stdin);
    //freopen("data.out","w",stdout);

    ios :: sync_with_stdio(false);
    cin.tie(0);

    cin >> n;

    for(int i=1;i<=n;i++)
        cin >> p[i].x >> p[i].y >> p[i].z;
    
    sort(p + 1,p + n + 1);
    reverse(p + 1,p + n + 1);
    set<int> s;

    int res = 0;

    for(int i=1;i<=n;i++)
    {
        int x = p[i].x;
        int y = p[i].y;
        int z = p[i].z;
        if(z == 1) s.insert(y);
        else
        {
            auto it = s.upper_bound(y);
            if(it != s.end())
            {
                res ++;
                s.erase(it);
            }        
        }
        
    }

    cout << res << endl;


    return 0;
}