太简单了
#include <stdio.h> #include <memory.h> #include <math.h> #include <string> #include <vector> #include <set> #include <stack> #include <queue> #include <algorithm> #include <map> #define I scanf #define OL puts #define O printf #define F(a,b,c) for(a=b;a<c;a++) #define FF(a,b) for(a=0;a<b;a++) #define FG(a,b) for(a=b-1;a>=0;a--) #define LEN 100000 #define MAX 0x06FFFFFF #define V vector<int> using namespace std; int a[LEN];//1e6 int main(){ freopen("d:/input/A1113/2.txt","r",stdin); int i=0,n; scanf("%d",&n); while(i<n){ scanf("%d",&a[i]); i++; } int sl=0,sr=0; int mid=n/2;//[0,mid),[mid,n) sort(a,a+n); FF(i,mid) sl+=a[i]; F(i,mid,n) sr+=a[i]; O("%d %d",n%2,abs(sl-sr)); return 0; }