QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#235152#6812. Draw a trianglezyfy#WA 0ms3524kbC++14956b2023-11-02 15:20:042023-11-02 15:20:04

Judging History

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

  • [2023-11-02 15:20:04]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3524kb
  • [2023-11-02 15:20:04]
  • 提交

answer

#include <bits/stdc++.h>
#define int long long
#define lowbit(x) x & (-x)
using namespace std;
const int mod = 1000000007;

int qpow(int x, int m) {
    int res = 1;
    while(m) {
        if(m % 2) res =res * x % mod;
        m >>= 1;
        x = x * x % mod;
    }
    return res;
}

void solve() {
    int n, m; cin >> n >> m;
    vector<int>a(n + 1);
    for(int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    int x = n;
    while(m--) {
        x = x + x * 2 % mod;
    }
    cout << x << endl;
    int res1=0,res2 = 0;
    int tmp = x;
    for(int i = 1; i <= n; i++) {
        res1 = res1 + a[i] * tmp % mod;
        tmp-=2;
    }
    tmp = x;
    for(int i = n; i >= 1; i--) {
        res2 = res2 + a[i] * tmp % mod;
        tmp-=2;
    }
    cout << max(res1, res2) << endl;
}


signed main() {
	ios::sync_with_stdio(false);
	int tt = 1;
	// cin >> tt;
	while (tt--) {
		solve();
	}
}




Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3524kb

input:

3
1 0 1 4
0 1 0 9
0 0 2 2

output:

9
43

result:

wrong answer wa on query #1 (test case 1)