QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#235152 | #6812. Draw a triangle | zyfy# | WA | 0ms | 3524kb | C++14 | 956b | 2023-11-02 15:20:04 | 2023-11-02 15:20:04 |
Judging History
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();
}
}
详细
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)