QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#660993#7941. Jackpotpranx2WA 14ms3600kbC++23694b2024-10-20 14:13:452024-10-20 14:13:46

Judging History

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

  • [2024-10-20 14:13:46]
  • 评测
  • 测评结果:WA
  • 用时:14ms
  • 内存:3600kb
  • [2024-10-20 14:13:45]
  • 提交

answer

#include <bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define PI pair<int, int>
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define bust ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
const ll INF = (ll)1e9 + 7, mod = 998244353;
using namespace std;
int main(){
  bust;
long tc,n;
cin>>tc;
while(tc--){
  cin>>n;
ll size = 2*n,temp = 0;
vector <int> arr(2*n);
nth_element(arr.begin(), arr.begin()+n,arr.end());
  for(int i = 0; i < size; i++){
    cin>>arr[i];
  }
  for(int i = 0; i < n; i++){
    temp -= arr[i];
  }
  for(int i = n; i < size; i++){
    temp += arr[i];
  }
cout<<temp<<"\n";
}
return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3528kb

input:

3
2
42 42 42 42
1
42 69
3
1 2 3 4 5 6

output:

0
27
9

result:

ok 3 number(s): "0 27 9"

Test #2:

score: -100
Wrong Answer
time: 14ms
memory: 3600kb

input:

47988
3
1 6 4 4 5 6
3
2 1 2 1 1 6
3
2 1 4 1 1 2
3
6 3 1 3 6 1
3
1 2 6 2 4 6
3
1 1 2 1 1 3
3
4 3 3 2 5 4
3
5 1 3 3 4 2
3
6 1 5 4 2 1
3
2 2 6 4 4 4
3
1 3 6 1 2 5
3
1 1 6 4 2 2
3
2 5 3 4 3 4
3
3 5 6 1 4 2
3
5 3 3 2 1 5
3
6 3 2 3 3 5
3
5 4 4 4 6 1
3
6 5 6 4 4 1
3
5 6 4 3 5 4
3
1 3 4 3 6 1
3
5 4 4 3 6 2
...

output:

4
3
-3
0
3
1
1
0
-5
2
-2
0
1
-7
-3
0
-2
-8
-3
2
-2
3
5
4
1
3
4
-4
5
7
-4
-3
2
-1
3
6
-7
-4
-4
2
6
-9
2
2
6
0
-1
-3
8
-2
2
-2
-8
3
7
-5
1
2
-2
1
-1
-1
-5
-2
-5
2
-3
3
5
3
1
4
-2
6
0
0
2
0
-1
-2
8
5
2
-1
-1
-5
-3
-5
0
-4
2
-1
4
6
1
-9
7
1
0
4
1
2
1
0
-1
9
4
10
-1
0
5
-2
0
2
1
1
1
3
-5
-8
2
9
-3
-7
8
1...

result:

wrong answer 1st numbers differ - expected: '8', found: '4'