QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#628496#6810. Array ConcatenationfoyonaczyWA 7ms4408kbC++201.0kb2024-10-10 20:35:482024-10-10 20:35:48

Judging History

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

  • [2024-10-10 20:35:48]
  • 评测
  • 测评结果:WA
  • 用时:7ms
  • 内存:4408kb
  • [2024-10-10 20:35:48]
  • 提交

answer

#include <bits/stdc++.h>

#define int long long
constexpr int MOD = 1e9 + 7;

int qpow(int a, int b) {
    int res = 1;
    while (b) {
        if (b & 1) res = res * a % MOD;
        a = a * a % MOD;
        b >>= 1;
    }
    return res;
}

int f[300005];

signed main() {
    int n, m;
    std::cin >> n >> m;
    int sum = 0;
    for (int i = 1; i <= n; i++) {
        int x;
        std::cin >> x;
        sum = (sum + x) % MOD;
    }
    f[2] = 4;
    for (int i = 3; i <= m; i++) {
        f[i] = (f[i - 1] * 2 % MOD + qpow(4, i - 1)) % MOD;
    }
    int ans = 0;
    int k = sum * n % MOD;
//    for (int i = 1; i < m; i++) {
//        int a = sum * qpow(2, i - 1) % MOD * ((n * qpow(2, i) % MOD + 1) % MOD) % MOD;
//        int N = m - i + 1;
//        int tmp = (qpow(2, N - 1) * a % MOD + k * f[N] % MOD) % MOD;
//        ans = std::max(ans, tmp);
//        k = k * 2 % MOD;
//    }
    ans = std::max(ans, sum * qpow(2, m - 1) % MOD * ((n * qpow(2, m) % MOD + 1) % MOD) % MOD);
    std::cout << ans << '\n';
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3620kb

input:

2 1
1 2

output:

15

result:

ok single line: '15'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3636kb

input:

5 10
26463 39326 86411 75307 85926

output:

806275469

result:

ok single line: '806275469'

Test #3:

score: 0
Accepted
time: 1ms
memory: 3652kb

input:

3 10000
329770536 859936159 696111818

output:

325223749

result:

ok single line: '325223749'

Test #4:

score: -100
Wrong Answer
time: 7ms
memory: 4408kb

input:

10 100000
910385778 832405357 79882277 740539785 58009121 361679935 208356273 191444931 327043571 40502864

output:

177280949

result:

wrong answer 1st lines differ - expected: '551220212', found: '177280949'