QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#637210 | #9415. Matrix | Sunwking | RE | 0ms | 0kb | C++20 | 521b | 2024-10-13 11:12:15 | 2024-10-13 11:12:15 |
answer
#include <bits/stdc++.h>
using namespace std;
long long b[500005];
int main()
{
int T;
scanf("%d", &T);
while (T --)
{
int n;
scanf("%d", &n);
for (int i = 1 ; i <= n ; ++ i)
scanf("%lld", b + i);
for (int i = n - 1 ; i ; -- i)
b[i] += b[i + 1];
printf("%lld ", b[1]);
long long Ans = b[1];
sort(b + 2, b + n + 1);
for (int i = n ; i > 1 ; -- i)
{
Ans += b[i];
printf("%lld ", Ans);
}
puts("");
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Runtime Error
input:
2