QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#373892#2291. Lopsided LineupkevinyangWA 1ms3620kbC++17485b2024-04-02 10:07:102024-04-02 10:07:13

Judging History

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

  • [2024-04-02 10:07:13]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3620kb
  • [2024-04-02 10:07:10]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
	cin.tie(nullptr)->sync_with_stdio(false);
	int n;
	cin >> n;
	vector<int>arr(n);
	for(int i = 0; i<n; i++){
		int s = 0;
		for(int j = 0; j<n; j++){
			int x;
			cin >> x;
			s+=x;
		}
		arr[i] = s;
	}
	sort(arr.begin(),arr.end());
	int ans = 0;
	for(int i = 0; i<n/2; i++){
		ans-=arr[i];
	}
	for(int i = n/2; i<n; i++){
		ans+=arr[i];
	}
	cout << ans << '\n';
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3620kb

input:

20
0 786505 911962 -800624 363821 -960995 -492637 -246590 140762 54707 -353306 -82216 -175650 567363 113374 761152 906126 -394096 -635055 675627
786505 0 801116 -323471 -34197 -860051 865281 737621 307515 -493253 -128788 -171663 -21931 853897 -505337 72985 941995 -380960 -223577 265322
911962 801116...

output:

42471200

result:

wrong answer 1st lines differ - expected: '21235600', found: '42471200'