QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#655410#7941. JackpotNITUL_WA 0ms3568kbC++201.2kb2024-10-19 04:16:392024-10-19 04:16:39

Judging History

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

  • [2024-10-19 04:16:39]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3568kb
  • [2024-10-19 04:16:39]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define foro(n) for(int i=0;i<int(n);i++)
#define for1(n) for(int i=1;i<=int(n);i++)
#define fup(a,n) for(int i=a;i<int(n);i++)
#define gcd __gcd
#define sz(x) (int)(x).size()
#define pb push_back
#define endl '\n'
#define F first
#define S second
#define D double
#define ld long double
const double epi = 1e-9;
const int inf = INT_MAX;
#define getunique(v) {sort(v.begin(), v.end()); v.erase(unique(v.begin(), v.end()), v.end());}
const int mod = 1e9 + 7;
ll lcm(ll a,ll b){
    int c=a*b;
    int k=gcd(a,b);
    return c/k;

}
ll range_sum(ll l, ll r){//to sum a range from a  to b permutation
    if(l>r)return 0;
    return  (l+r)*(r-l+1)/2;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int t=1;
    cin>>t;
    while(t--){
        int n; cin>>n;
        vector<int> v(2*n);
        foro(2*n)cin>>v[i];
        sort(all(v));
        ll ans=0;
        for(int i=0,j=n-1;i<n;i++,j--){
            ans+=abs(v[i]-v[j]);
        }
        cout<<ans<<endl;
   }
}

详细

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3568kb

input:

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

output:

0
0
4

result:

wrong answer 2nd numbers differ - expected: '27', found: '0'