QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#235154 | #6812. Draw a triangle | zyfy# | WA | 0ms | 3368kb | C++14 | 956b | 2023-11-02 15:20:32 | 2023-11-02 15:20:32 |
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();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3368kb
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)