Submission #8523525
Source Code Expand
#include<bits/stdc++.h> using namespace std; using ll = long long; const ll INF = 1e9; const int MAXN = 2.1e5; int N; int X[MAXN]; int Y[MAXN]; pair<int, int> P[MAXN]; int minx[MAXN]; int maxx[MAXN]; int miny[MAXN]; int maxy[MAXN]; int main() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); cin >> N; for (int i = 0; i < N; i++) { cin >> X[i] >> Y[i]; if (X[i] > Y[i]) swap(X[i], Y[i]); P[i] = {X[i], Y[i]}; } sort(P, P + N); for (int i = 0; i < N; i++) { tie(X[i],Y[i]) = P[i]; } ll ans = ll(*max_element(X,X+N) - *min_element(X,X+N)) * ll(*max_element(Y,Y+N) - *min_element(Y,Y+N)); int V = *max_element(Y,Y+N) - *min_element(X,X+N); miny[0] = INF; maxy[0] = -INF; for (int i = 0; i < N; i++) { miny[i+1] = min(miny[i], Y[i]); maxy[i+1] = max(maxy[i], Y[i]); } minx[N] = INF; maxx[N] = -INF; for (int i = N-1; i >= 0; i--) { minx[i] = min(minx[i+1], X[i]); maxx[i] = max(maxx[i+1], X[i]); } for (int i = 0; i <= N; i++) { ans = max(ans, ll(V)*ll(max(maxx[i],maxy[i]) - min(minx[i],miny[i]))); } cout << ans << '\n'; return 0; }
Submission Info
Submission Time | |
---|---|
Task | E - Ball Coloring |
User | ecnerwala |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1135 Byte |
Status | WA |
Exec Time | 63 ms |
Memory | 6784 KB |
Judge Result
Set Name | Sample | All | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 700 | ||||||||
Status |
|
|
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 | 59 ms | 6656 KB |
div21 | WA | 60 ms | 6656 KB |
div22 | WA | 59 ms | 6656 KB |
div23 | WA | 59 ms | 6784 KB |
div24 | WA | 59 ms | 6656 KB |
example0 | WA | 2 ms | 4352 KB |
example1 | WA | 2 ms | 4352 KB |
example2 | AC | 2 ms | 4352 KB |
maxrand0 | WA | 59 ms | 6784 KB |
maxrand1 | WA | 59 ms | 6784 KB |
maxrand2 | WA | 60 ms | 6784 KB |
maxrand20 | WA | 63 ms | 6784 KB |
maxrand21 | WA | 61 ms | 6784 KB |
maxrand210 | WA | 61 ms | 6784 KB |
maxrand211 | WA | 62 ms | 6784 KB |
maxrand22 | WA | 62 ms | 6784 KB |
maxrand23 | WA | 62 ms | 6656 KB |
maxrand24 | WA | 60 ms | 6656 KB |
maxrand25 | WA | 62 ms | 6784 KB |
maxrand26 | WA | 62 ms | 6784 KB |
maxrand27 | WA | 62 ms | 6656 KB |
maxrand28 | WA | 61 ms | 6656 KB |
maxrand29 | WA | 60 ms | 6656 KB |
maxrand3 | WA | 59 ms | 6656 KB |
maxrand4 | WA | 60 ms | 6784 KB |
smallrand0 | WA | 2 ms | 4352 KB |
smallrand1 | WA | 2 ms | 4352 KB |
smallrand2 | WA | 2 ms | 4352 KB |
smallrand3 | WA | 2 ms | 4352 KB |
smallrand4 | WA | 2 ms | 4352 KB |
sparse0 | WA | 60 ms | 6656 KB |
sparse1 | WA | 59 ms | 6784 KB |
sparse2 | WA | 59 ms | 6656 KB |
sparse3 | WA | 60 ms | 6784 KB |
sparse4 | WA | 60 ms | 6656 KB |