Submission #19216214


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];
    }
    sort(all(v));
    
    out(v[m-1] - v[0]);    
    re0;
}

Submission Info

Submission Time
Task A - Table Tennis
User dekomori_sanae
Language C++ (GCC 9.2.1)
Score 100
Code Size 1099 Byte
Status AC
Exec Time 5 ms
Memory 3640 KB

Judge Result

Set Name All
Score / Max Score 100 / 100
Status
AC × 27
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 5 ms 3600 KB
00-sample-01.txt AC 2 ms 3488 KB
10-unique-00.txt AC 2 ms 3596 KB
10-unique-01.txt AC 3 ms 3552 KB
10-unique-02.txt AC 2 ms 3632 KB
10-unique-03.txt AC 2 ms 3628 KB
10-unique-04.txt AC 2 ms 3596 KB
20-order-00.txt AC 3 ms 3428 KB
20-order-01.txt AC 2 ms 3476 KB
20-order-02.txt AC 2 ms 3416 KB
20-order-03.txt AC 2 ms 3496 KB
20-order-04.txt AC 2 ms 3524 KB
30-random-00.txt AC 2 ms 3492 KB
30-random-01.txt AC 2 ms 3416 KB
30-random-02.txt AC 2 ms 3496 KB
30-random-03.txt AC 2 ms 3424 KB
30-random-04.txt AC 2 ms 3440 KB
30-random-05.txt AC 4 ms 3604 KB
30-random-06.txt AC 2 ms 3556 KB
30-random-07.txt AC 2 ms 3500 KB
30-random-08.txt AC 2 ms 3556 KB
30-random-09.txt AC 3 ms 3640 KB
30-random-10.txt AC 2 ms 3604 KB
30-random-11.txt AC 2 ms 3552 KB
30-random-12.txt AC 2 ms 3496 KB
30-random-13.txt AC 3 ms 3492 KB
30-random-14.txt AC 2 ms 3496 KB