Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
133921 莫栋涛 田忌赛马 C++ 编译错误 0 0 MS 0 KB 721 2024-03-02 10:39:48

Tests(0/0):


#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 }


测评信息: