Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
133763 | 莫栋涛 | 田忌赛马 | C++ | 解答错误 | 40 | 0 MS | 252 KB | 682 | 2024-03-02 09:10:08 |
#include <bits/stdc++.h> using namespace std; int 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; } }