QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#637210#9415. MatrixSunwkingRE 0ms0kbC++20521b2024-10-13 11:12:152024-10-13 11:12:15

Judging History

你现在查看的是最新测评结果

  • [2024-10-13 11:12:15]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [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

output:


result: