4 条题解

  • -1
    @ 2025-7-18 16:50:25

    #include <bits/stdc++.h> using namespace std; int a[25005], b[25005];

    int main() { int x, y, n, s = 0; cin >> n >> x >> y; for (int i = 0; i < n; i++) { cin >> a[i] >> b[i];

    }
    sort(a, a + n);
    sort(b, b + n);
    for (int i = 0; i < n; i++) {
    	if (a[i] > b[i])
    		s = s + (a[i] - b[i]) * y;
    	if (a[i] < b[i])
    		s = s + (b[i] - a[i]) * x;
    
    }
    cout << s ;
    return 0;
    

    }

    信息

    ID
    370
    时间
    1000ms
    内存
    64MiB
    难度
    6
    标签
    递交数
    29
    已通过
    12
    上传者