提交时间:2024-03-02 10:40:09
运行 ID: 133922
#include <bits/stdc++.h> #define int long long using namespace std; signed main() { while (true) { int n; cin >> n; if (n == 0) return 0; priority_queue<int, vector<int>, greater<int> > aq, bq; for (int i = 1; i <= n; i++) { int x; cin >> x; aq.push(x); } for (int i = 1; i <= n; i++) { int x; cin >> x; bq.push(x); } long long money = 0; for (int i = 1; i <= n; i++) { int horse = bq.top(); bq.pop(); while (!aq.empty()) { if (aq.top() >= horse) break; aq.pop(); } if (aq.empty()) { money -= 200; continue; } if (aq.top() > horse) money += 200; aq.pop(); } cout << money << endl; } return 0; }