Contest Duration: - (local time) (120 minutes)

Submission #19216191

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];
}

ll ans = INF;
exrep(i1, 0, n-4) {
exrep(i2, i1+1, n-3) {
exrep(i3, i2+1, n-2) {
exrep(i4, i3+1, n-1) {
// (i1, i2) と (i3, i4) に分けるとき
chmin(ans, abs(a[i1] + a[i2] - a[i3] - a[i4]));
// (i1, i3) と (i2, i4) に分けるとき
chmin(ans, abs(a[i1] + a[i3] - a[i2] - a[i4]));
// (i1, i4) と (i2, i3) に分けるとき
chmin(ans, abs(a[i1] + a[i4] - a[i2] - a[i3]));
}
}
}
}

out(ans);
re0;
}```

#### Submission Info

Submission Time 2021-01-05 18:23:20+0900 A - Table Tennis dekomori_sanae C++ (GCC 9.2.1) 0 1566 Byte WA 24 ms 3632 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 10 ms 3492 KB
00-sample-01.txt AC 2 ms 3552 KB
10-unique-00.txt AC 5 ms 3548 KB
10-unique-01.txt AC 18 ms 3600 KB
10-unique-02.txt AC 8 ms 3496 KB
10-unique-03.txt AC 13 ms 3632 KB
10-unique-04.txt AC 7 ms 3432 KB
20-order-00.txt AC 2 ms 3596 KB
20-order-01.txt AC 24 ms 3556 KB
20-order-02.txt AC 7 ms 3624 KB
20-order-03.txt AC 14 ms 3552 KB
20-order-04.txt AC 2 ms 3468 KB
30-random-00.txt AC 2 ms 3468 KB
30-random-01.txt WA 22 ms 3576 KB
30-random-02.txt AC 3 ms 3600 KB
30-random-03.txt WA 8 ms 3492 KB
30-random-04.txt WA 15 ms 3632 KB
30-random-05.txt WA 13 ms 3524 KB
30-random-06.txt WA 9 ms 3552 KB
30-random-07.txt WA 5 ms 3604 KB
30-random-08.txt WA 3 ms 3552 KB
30-random-09.txt WA 2 ms 3628 KB
30-random-10.txt WA 3 ms 3420 KB
30-random-11.txt WA 6 ms 3492 KB
30-random-12.txt WA 5 ms 3420 KB
30-random-13.txt WA 23 ms 3496 KB
30-random-14.txt WA 6 ms 3416 KB