求助,为什么会报错
  • 板块学术版
  • 楼主Maysoul
  • 当前回复8
  • 已保存回复8
  • 发布时间2023/4/3 14:58
  • 上次更新2023/10/23 19:33:15
查看原帖
求助,为什么会报错
409774
Maysoul楼主2023/4/3 14:58

class Solution {
public:
    struct per{
        int acost,bcost;
        int num;
        bool friend operator > (per a,per b)
        {
            return a.acost<b.acost;
        }
    }a[110];
    struct per1{
        int acost,bcost;
        int num;
        bool friend operator > (per1 a,per1 b)
        {
            return a.bcost<b.bcost;
        }
    }b[110];
    int twoCitySchedCost(vector<vector<int>>& costs) {
       int n=costs.size();
       for (int i=0;i<n;i++)
       {
           a[i].acost=costs[i][0];
           a[i].bcost=costs[i][1];
           a[i].num=i;
           b[i].acost=costs[i][0];
           b[i].bcost=costs[i][1];
           b[i].num=i;
       }
       sort(a,a+n);
       sort(b,b+n);
       for (int i=0;i<n;i++)
       {
           cout<<a[i].acost<<" "<<a[i].bcost<<endl;
       }
       for (int i=0;i<n;i++)
       {
           cout<<b[i].acost<<" "<<b[i].bcost<<endl;
       }
       return 1;
    }
};
2023/4/3 14:58
加载中...