Contest Duration: - (local time) (100 minutes) Back to Home

Submission #2900801

Source Code Expand

Copy
```#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>

#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;
const double EPS=1e-9;

const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

int main() {
int N;
cin >> N;
vector<ll> A(N);
for (int i = 0; i < N; i++) {
cin >> A[i];
}
vector<ll> acc(N + 1);
for (int i = 0; i < N; i++) {
acc[i + 1] = acc[i] + A[i];
}

ll mi = 1LL << 61;
for(int j = 2; j <= N - 1; j++) {
int i1 = lower_bound(acc.begin(), acc.end(), acc[j] / 2) - acc.begin();
int k1 = lower_bound(acc.begin(), acc.end(), (acc[N] - acc[j]) / 2 + acc[j]) - acc.begin();
vector<int> I = {i1};
vector<int> K = {k1};
if (i1 > 0) I.push_back(i1 - 1);
if (k1 - 1 > j) K.push_back(k1 - 1);

for (int u = 0; u < I.size(); u++) {
for (int v = 0; v < K.size(); v++) {
int i = I[u], k = K[v];
ll area = max({acc[i], acc[j] - acc[i], acc[k] - acc[j], acc[N] - acc[k]}) - min({acc[i], acc[j] - acc[i], acc[k] - acc[j], acc[N] - acc[k]});
mi = min(mi, area);
}
}
}
cout << mi << endl;
return 0;
}```

#### Submission Info

Submission Time 2018-07-24 22:19:25+0900 D - Equal Cut kakira C++14 (GCC 5.4.1) 600 1807 Byte AC 117 ms 3328 KB

#### Judge Result

Set Name Sample All
Score / Max Score 0 / 0 600 / 600
Status
 AC × 3
 AC × 43
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
Case Name Status Exec Time Memory
sample_01.txt AC 1 ms 256 KB
sample_02.txt AC 1 ms 256 KB
sample_03.txt AC 1 ms 256 KB
subtask_1_01.txt AC 1 ms 256 KB
subtask_1_02.txt AC 114 ms 3072 KB
subtask_1_03.txt AC 43 ms 1536 KB
subtask_1_04.txt AC 79 ms 2176 KB
subtask_1_05.txt AC 1 ms 256 KB
subtask_1_06.txt AC 12 ms 640 KB
subtask_1_07.txt AC 59 ms 2048 KB
subtask_1_08.txt AC 34 ms 1408 KB
subtask_1_09.txt AC 58 ms 1920 KB
subtask_1_10.txt AC 70 ms 2688 KB
subtask_1_11.txt AC 91 ms 3072 KB
subtask_1_12.txt AC 41 ms 1664 KB
subtask_1_13.txt AC 62 ms 2176 KB
subtask_1_14.txt AC 19 ms 896 KB
subtask_1_15.txt AC 13 ms 640 KB
subtask_1_16.txt AC 40 ms 1920 KB
subtask_1_17.txt AC 35 ms 1664 KB
subtask_1_18.txt AC 3 ms 384 KB
subtask_1_19.txt AC 71 ms 3072 KB
subtask_1_20.txt AC 117 ms 3072 KB
subtask_1_21.txt AC 49 ms 1792 KB
subtask_1_22.txt AC 40 ms 1152 KB
subtask_1_23.txt AC 81 ms 2816 KB
subtask_1_24.txt AC 91 ms 3328 KB
subtask_1_25.txt AC 91 ms 3328 KB
subtask_1_26.txt AC 91 ms 3328 KB
subtask_1_27.txt AC 90 ms 3328 KB
subtask_1_28.txt AC 91 ms 3328 KB
subtask_1_29.txt AC 93 ms 3328 KB
subtask_1_30.txt AC 92 ms 3328 KB
subtask_1_31.txt AC 93 ms 3328 KB
subtask_1_32.txt AC 92 ms 3328 KB
subtask_1_33.txt AC 92 ms 3328 KB
subtask_1_34.txt AC 75 ms 3328 KB
subtask_1_35.txt AC 77 ms 3328 KB
subtask_1_36.txt AC 75 ms 3328 KB
subtask_1_37.txt AC 76 ms 3328 KB