QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#648551#9223. Data Determinationucup-team963#WA 1ms5660kbC++141.3kb2024-10-17 19:29:052024-10-17 19:29:07

Judging History

你现在查看的是最新测评结果

  • [2024-10-17 19:29:07]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:5660kb
  • [2024-10-17 19:29:05]
  • 提交

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();
}

Details

Tip: Click on the bar to expand more detailed information

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'