Submission #19216128


Source Code Expand

Copy
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;

int main() {
    ll n;
    cin >> n;

    vl a(n);
    rep(i, n) {
        cin >> a[i];
    }
    sort(all(a));

    ll m = n/2;
    vl v(m);
    rep(i, m) {
        v[i] = a[i] + a[n-1-i];
    }
    
    ll ans = INF;
    exrep(i, 0, m-2) {
        exrep(j, i+1, m-1) {
            chmin(ans, abs(v[i] - v[j]));
        }
    }

    out(ans);    
    re0;
}

Submission Info

Submission Time
Task A - Table Tennis
User dekomori_sanae
Language C++ (GCC 9.2.1)
Score 0
Code Size 1203 Byte
Status WA
Exec Time 6 ms
Memory 3640 KB

Judge Result

Set Name All
Score / Max Score 0 / 100
Status
AC × 14
WA × 13
Set Name Test Cases
All 00-sample-00.txt, 00-sample-01.txt, 10-unique-00.txt, 10-unique-01.txt, 10-unique-02.txt, 10-unique-03.txt, 10-unique-04.txt, 20-order-00.txt, 20-order-01.txt, 20-order-02.txt, 20-order-03.txt, 20-order-04.txt, 30-random-00.txt, 30-random-01.txt, 30-random-02.txt, 30-random-03.txt, 30-random-04.txt, 30-random-05.txt, 30-random-06.txt, 30-random-07.txt, 30-random-08.txt, 30-random-09.txt, 30-random-10.txt, 30-random-11.txt, 30-random-12.txt, 30-random-13.txt, 30-random-14.txt
Case Name Status Exec Time Memory
00-sample-00.txt AC 6 ms 3636 KB
00-sample-01.txt AC 2 ms 3440 KB
10-unique-00.txt AC 2 ms 3424 KB
10-unique-01.txt AC 2 ms 3552 KB
10-unique-02.txt AC 3 ms 3500 KB
10-unique-03.txt AC 1 ms 3496 KB
10-unique-04.txt AC 2 ms 3600 KB
20-order-00.txt AC 2 ms 3604 KB
20-order-01.txt AC 2 ms 3580 KB
20-order-02.txt AC 2 ms 3552 KB
20-order-03.txt AC 2 ms 3448 KB
20-order-04.txt AC 2 ms 3424 KB
30-random-00.txt AC 2 ms 3564 KB
30-random-01.txt WA 2 ms 3632 KB
30-random-02.txt AC 2 ms 3424 KB
30-random-03.txt WA 2 ms 3420 KB
30-random-04.txt WA 2 ms 3428 KB
30-random-05.txt WA 2 ms 3560 KB
30-random-06.txt WA 2 ms 3556 KB
30-random-07.txt WA 2 ms 3608 KB
30-random-08.txt WA 2 ms 3608 KB
30-random-09.txt WA 2 ms 3472 KB
30-random-10.txt WA 2 ms 3640 KB
30-random-11.txt WA 2 ms 3528 KB
30-random-12.txt WA 2 ms 3424 KB
30-random-13.txt WA 2 ms 3608 KB
30-random-14.txt WA 2 ms 3496 KB