Skip to content

Latest commit

 

History

History
48 lines (40 loc) · 825 Bytes

1113.md

File metadata and controls

48 lines (40 loc) · 825 Bytes

1113

image.png

#include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>
using namespace std;

int main() {
	int N;
	cin >> N;
	vector<int> v(N);
	for (int n = 0; n < N; n++) {
		cin >> v[n];
	}
	sort(v.begin(), v.end());
	/*
	for (auto it : v) {
		cout << it << " ";
	}
	cout << endl;
	// */
	cout << N % 2 << " " << accumulate(v.begin(), v.end(), 0) - 2 * accumulate(v.begin(), v.begin() + N / 2, 0) << endl;
	return 0;
}

/*
Sample Input 1:
10
23 8 10 99 46 2333 46 1 666 555
Sample Output 1:
0 3611
Sample Input 2:
13
110 79 218 69 3721 100 29 135 2 6 13 5188 85
Sample Output 2:
1 9359
*/

References