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; }
点赞 1

相关推荐

没hc还海面!呜呜,避雷
回收旧报纸:没有海面吧,我做完笔试有一个多月了,还没消息
点赞 评论 收藏
分享
10-09 16:12
门头沟学院 Java
帅宇殿下:佬,简历写的什么
点赞 评论 收藏
分享
09-09 21:23
门头沟学院 Java
程序员牛肉:小牛肉来也! 主要就是没有实习经历。因为你的投递方向肯定是中小厂。在小厂中,很少会有公司愿意花钱培养你。因此会更加青睐有实习的同学。再加上你的学历比较差一点,所以找不到是正常的。 跟简历项目啥的已经没有大关系了,就是差一份实习。秋招和日常实习一起投递吧。
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务