Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
133633 | 黄一航 | 数列极差问题 | C++ | 解答错误 | 33 | 0 MS | 256 KB | 629 | 2024-03-02 08:47:14 |
#include <bits/stdc++.h> #define int long long using namespace std; priority_queue<int> q1; priority_queue<int,vector<int>,greater<int> > q2; signed main() { int n; cin >> n; while (n != 0) { for (int i = 1; i <= n; i++) { int x; cin >> x; q1.push(x); q2.push(x); } while (q1.size() >= 2) { int x = q1.top(); q1.pop(); int y = q1.top(); q1.pop(); q1.push(x * y + 1); } while (q2.size() >= 2) { int x = q2.top(); q2.pop(); int y = q2.top(); q2.pop(); q2.push(x * y + 1); } printf("%lld\n",q2.top() - q1.top()); cin >> n; } return 0; }