QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#648551 | #9223. Data Determination | ucup-team963# | WA | 1ms | 5660kb | C++14 | 1.3kb | 2024-10-17 19:29:05 | 2024-10-17 19:29:07 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define debug(x) cerr << #x << ": " << x << '\n';
#define bd cerr << "----------------------" << el;
#define el '\n'
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define lop(i, a, b) for (int i = (a); i < (b); i++)
#define dwn(i, a, b) for (int i = (a); i >= (b); i--)
#define cmax(a, b) a = max(a, b)
#define cmin(a, b) a = min(a, b)
#define x first
#define y second
#define db double
#define ceil(a, b) (((a) + (b) - 1) / (b))
typedef long long LL;
typedef pair<int, int> PII;
constexpr int N = (1 << 16) + 1e6, md = 1e9 + 7;
constexpr LL INF = 1e18;
int n, m;
int a[N];
LL pre[N];
int e[50];
void solve()
{
cin >> n;
e[0] = 1;
int len = 1 << n;
rep(i, 1, 40)
{
e[i] = e[i - 1] * 2;
if(e[i] >= len)
{
break;
}
}
rep(i, 1, len)
{
cin >> a[i];
}
sort(a + 1, a + len + 1, greater<int>());
rep(i, 1, len)
{
pre[i] = pre[i - 1] + a[i];
}
LL ans = -INF;
rep(i, 0, 40)
{
cmax(ans, pre[e[i]]);
if(e[i] >= len)
break;
}
cout << ans << el;
}
signed main()
{
cin.tie(0)->sync_with_stdio(false);
cout.tie(0);
solve();
}
详细
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 5660kb
input:
3 6 4 42 41 43 41 57 41 42 4 2 4 1 2 5 8 7 5 57 101 2 42 5 57 7 13
output:
275
result:
wrong answer 1st lines differ - expected: 'TAK', found: '275'