QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#620429#9142. Uniting Amoebassjzsd147TL 1ms4360kbC++14453b2024-10-07 18:06:312024-10-07 18:06:31

Judging History

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

  • [2024-10-07 18:06:31]
  • 评测
  • 测评结果:TL
  • 用时:1ms
  • 内存:4360kb
  • [2024-10-07 18:06:31]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int T;
int a[200005],n;
ll ans;
int main(){
//	freopen("merge.in","r",stdin);
//	freopen("merge.out","w",stdout);
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin>>T;
	while(T--){
		ans=0;
		memset(a,0,sizeof(a));
		cin>>n;
		for(int i=1;i<=n;i++){
			cin>>a[i];
		}
		sort(a+1,a+n+1);
		for(int i=1;i<n;i++){
			ans+=a[i];
		}
		cout<<ans<<'\n';
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 4360kb

input:

3
3
1 1 1
4
0 1 0 2
2
100 42

output:

2
1
42

result:

ok 3 number(s): "2 1 42"

Test #2:

score: -100
Time Limit Exceeded

input:

100000
2
653035426 456936267
2
409660907 250295986
2
347384960 200356123
2
283557883 840123319
2
17610671 987402881
2
136895857 909667348
2
248911778 780375903
2
275329617 285342631
2
561813712 698064200
2
400903421 742043963
2
345893112 519641162
2
14593307 406479738
2
616391850 347632216
2
1973087...

output:

456936267
250295986
200356123
283557883
17610671
136895857
248911778
275329617
561813712
400903421
345893112
14593307
347632216
19730879
421626272
56181583
370600905
308183211
258362299
586922640
40159075
198139063
142754581
51756812
119730671
81065481
143568225
273158312
49357396
14434997
396080587...

result: