QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#837824 | #9920. Money Game 2 | propane | WA | 1ms | 3464kb | C++20 | 1.5kb | 2024-12-30 14:39:06 | 2024-12-30 14:39:07 |
Judging History
This is the latest submission verdict.
- [2024-12-31 22:17:02]
- hack成功,自动添加数据
- (/hack/1322)
- [2024-12-31 21:57:13]
- hack成功,自动添加数据
- (/hack/1321)
- [2024-12-30 14:39:06]
- Submitted
answer
#include<iostream>
#include<cstring>
#include<vector>
#include<array>
#include<algorithm>
using namespace std;
using LL = long long;
int main(){
#ifdef LOCAL
freopen("data.in", "r", stdin);
freopen("data.out", "w", stdout);
#endif
cin.tie(0);
cout.tie(0);
ios::sync_with_stdio(0);
const int M = 33;
int T;
cin >> T;
while(T--){
int n;
cin >> n;
vector<int> a(n);
vector<int> pos;
for(int i = 0; i < n; i++){
cin >> a[i];
if (a[i] != 1) pos.push_back(i);
}
vector<array<LL, M + 1> > l(n), r(n);
for(int i = 0; i < n; i++){
l[i][0] = a[i];
for(int j = 1; j <= M and j < n; j++){
l[i][j] = l[i][j - 1] / 2 + a[(i - j + n) % n];
}
r[i][0] = a[i];
for(int j = 1; j <= M and j < n; j++){
r[i][j] = r[i][j - 1] / 2 + a[(i + j) % n];
}
}
for(int i = 0; i < n; i++){
LL ans = a[i];
for(int j = 0; j <= M and j < n; j++){
for(int k = 0; k <= M and j + k < n; k++){
ans = max(ans, r[(i - j + n) % n][j] + l[(i + k) % n][k] - a[i]);
}
}
if (pos.size() >= 2){
ans = max(ans, ans + 2);
}
if (pos.size() >= 1){
ans = max(ans, ans + 1);
}
cout << ans << " \n"[i + 1 == n];
}
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3464kb
input:
3 5 2 1 4 3 5 5 2 1 3 1 2 1 1000000000
output:
9 8 10 11 11 7 7 8 7 7 1000000001
result:
wrong answer 1st numbers differ - expected: '6', found: '9'