Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
133751 吴晨曦 数列极差问题 C++ 解答错误 33 0 MS 248 KB 600 2024-03-02 09:01:56

Tests(1/3):


#include <bits/stdc++.h> using namespace std; priority_queue <int, vector <int>, greater <int> > q1; priority_queue <int> q2; int main() { int n; cin >> n; for (int i = 1, u; i <= n; i++) { cin >> u; q1.push(u); q2.push(u); } while (q1.size() != 1) { int tmp1 = q1.top(); q1.pop(); int tmp2 = q1.top(); q1.pop(); int tmp3 = tmp1 * tmp2 + 1; q1.push(tmp3); } while (q2.size() != 1) { int tmp1 = q2.top(); q2.pop(); int tmp2 = q2.top(); q2.pop(); int tmp3 = tmp1 * tmp2 + 1; q2.push(tmp3); } cout << q1.top() - q2.top() << endl; }


测评信息: