Submission #1533194


Source Code Expand

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

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

    vector<ll> x(n), y(n);
    for (int i = 0; i < n; i++) {
        cin >> x[i] >> y[i];
    }

    if (n == 1) {
        cout << 0 << endl;
        return 0;
    }
    
    ll maxr = max(x[1], x[0]), minr = min(x[1], x[0]);
    ll maxb = max(y[1], y[0]), minb = min(y[1], y[0]);
    if (abs(x[1] - x[0]) * abs(y[1] - y[0]) > abs(x[1] - y[0]) * abs(y[1] - x[0])) {
        maxr = max(x[1], y[0]), minr = min(x[1], y[0]);
        maxb = max(y[1], x[0]), minb = min(y[1], x[0]);
    }

    for (int i = 2; i < n; i++) {
        ll a = max(max(abs(x[i] - minr), abs(x[i] - maxr)), maxr - minr);
        ll b = max(max(abs(x[i] - minb), abs(x[i] - maxb)), maxb - minb);
        ll c = max(max(abs(y[i] - minr), abs(y[i] - maxr)), maxr - minr);
        ll d = max(max(abs(y[i] - minb), abs(y[i] - maxb)), maxb - minb);
        ll R = x[i], B = y[i];
        if (a * d > c * b) {
            R = y[i], B = x[i];
        }
        maxr = max(maxr, R);
        minr = min(minr, R);
        maxb = max(maxb, B);
        minb = min(minb, B);
    }

    cout << (maxr - minr) * (maxb - minb) << endl;

    return 0;
}

Submission Info

Submission Time
Task E - Ball Coloring
User legosuke
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1264 Byte
Status WA
Exec Time 166 ms
Memory 3328 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 700
Status
AC × 3
AC × 25
WA × 10
Set Name Test Cases
Sample example0, example1, example2
All div20, div21, div22, div23, div24, example0, example1, example2, maxrand0, maxrand1, maxrand2, maxrand20, maxrand21, maxrand210, maxrand211, maxrand22, maxrand23, maxrand24, maxrand25, maxrand26, maxrand27, maxrand28, maxrand29, maxrand3, maxrand4, smallrand0, smallrand1, smallrand2, smallrand3, smallrand4, sparse0, sparse1, sparse2, sparse3, sparse4
Case Name Status Exec Time Memory
div20 WA 161 ms 3328 KB
div21 AC 160 ms 3328 KB
div22 AC 160 ms 3328 KB
div23 WA 161 ms 3328 KB
div24 WA 161 ms 3328 KB
example0 AC 1 ms 256 KB
example1 AC 1 ms 256 KB
example2 AC 1 ms 256 KB
maxrand0 AC 159 ms 3328 KB
maxrand1 AC 159 ms 3328 KB
maxrand2 WA 159 ms 3328 KB
maxrand20 AC 157 ms 3328 KB
maxrand21 AC 161 ms 3328 KB
maxrand210 AC 162 ms 3328 KB
maxrand211 AC 161 ms 3328 KB
maxrand22 AC 161 ms 3328 KB
maxrand23 AC 166 ms 3328 KB
maxrand24 AC 161 ms 3328 KB
maxrand25 AC 161 ms 3328 KB
maxrand26 AC 161 ms 3328 KB
maxrand27 AC 161 ms 3328 KB
maxrand28 AC 161 ms 3328 KB
maxrand29 AC 160 ms 3328 KB
maxrand3 WA 161 ms 3328 KB
maxrand4 AC 159 ms 3328 KB
smallrand0 WA 1 ms 256 KB
smallrand1 WA 1 ms 256 KB
smallrand2 AC 1 ms 256 KB
smallrand3 AC 1 ms 256 KB
smallrand4 AC 1 ms 256 KB
sparse0 WA 159 ms 3328 KB
sparse1 AC 159 ms 3328 KB
sparse2 WA 159 ms 3328 KB
sparse3 AC 160 ms 3328 KB
sparse4 WA 160 ms 3328 KB