QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#661162 | #7941. Jackpot | pranx2 | WA | 45ms | 4688kb | C++23 | 536b | 2024-10-20 14:59:08 | 2024-10-20 14:59:09 |
Judging History
answer
#include <bits/stdc++.h>
#define ll long long
#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;
vector <int> arr(2*n);
for(int i = 0; i < size; i++) cin>>arr[i];
sort(arr.begin(),arr.end());//sorting;
int temp = 0;
for(int i = 0; i < size/2; i++){
temp += abs(arr[i] - arr[(size/2)+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: 3624kb
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: 0
Accepted
time: 15ms
memory: 3824kb
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:
8 7 5 10 11 3 5 6 11 6 10 8 5 9 7 6 6 8 5 8 6 5 9 8 7 11 10 8 7 9 10 7 10 7 9 10 11 4 6 6 8 9 6 4 6 6 5 7 8 10 6 6 8 5 7 5 7 4 4 9 7 5 5 6 13 6 7 9 11 7 11 6 12 6 8 8 6 10 3 8 8 7 6 7 7 5 9 7 6 10 6 5 8 10 5 9 11 7 8 8 9 10 5 2 5 9 12 10 5 6 13 6 10 8 5 9 7 7 5 8 8 9 7 9 8 10 11 10 7 11 10 7 8 13 10...
result:
ok 47988 numbers
Test #3:
score: -100
Wrong Answer
time: 45ms
memory: 4688kb
input:
1 199996 95228303 201285494 63848235 748936712 940169142 379639162 189291770 224201078 335564466 792345215 948056869 35198826 312793561 194588099 297198853 665606109 163797196 584404459 996890415 458867609 331820116 713293915 858136035 520976262 519894660 918315819 660535535 639896052 141007070 1151...
output:
-459495942
result:
wrong answer 1st numbers differ - expected: '99930544580090', found: '-459495942'