QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#726462 | #8723. 乘二 | FristCrushd | WA | 53ms | 5056kb | C++20 | 1.1kb | 2024-11-09 01:06:49 | 2024-11-09 01:06:50 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N = 2e5 + 10;
const int mod = 1e9 + 7;
int qpow(int a, int p) {
a %= mod;
int res = 1;
for (; p > 0; p >>= 1, a = a * a % mod) {
if (p & 1) res = res * a % mod;
}
return res;
}
int a[N];
signed main() {
int n, k;
cin >> n >> k;
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
sort(a + 1, a + 1 + n);
for (int i = 1; i <= 40; i++) {
int last = 1;
for (int j = 2; j <= n; j++) {
if (a[1] * 2 <= a[j]) {
last = j;
break;
}
}
for (int j = 1; j < last; j++) {
while (k > 0 && a[j] * 2 <= a[last]) {
a[j] *= 2;
k--;
}
}
}
int tmp = k / n;
for (int i = 1; i <= k % n; i++) {
a[i] *= 2;
}
int ans = 0;
for (int i = 1; i <= n; i++) {
ans = (ans + a[i]) % mod;
}
cout << (ans % mod * qpow(2, tmp) % mod) % mod << endl;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3560kb
input:
3 3 7 2 1
output:
15
result:
ok 1 number(s): "15"
Test #2:
score: -100
Wrong Answer
time: 53ms
memory: 5056kb
input:
200000 1605067 366760624 67854 93901 693975 27016 1046 10808 6533158 54778 500941023 77236442 32173 10431454 2 9726 1553148 89282 411182309 494073 131299543 249904771 7906930 353 9909 3632698 29156 1917186 303 737 1189004 22 1983 263 711 4106258 2070 36704 12524642 5192 123 2061 22887 66 380 1 10153...
output:
591070776
result:
wrong answer 1st numbers differ - expected: '707034173', found: '591070776'