Submission #163877

#TimeUsernameProblemLanguageResultExecution timeMemory
163877YazanZkCover (COCI18_cover)C++14
36 / 120
4 ms632 KiB
#include <bits/stdc++.h> typedef long long ll ; using namespace std; int main() { ios::sync_with_stdio(false), cin.tie(0), cout.tie(0); int n ; cin >> n ; vector < pair < ll, ll > > ve; for(int i = 0 ; i < n ; i++) { ll x,y ; cin >> x >> y ; x = abs(x); y = abs(y); ve.push_back({x, y}); } sort(ve.rbegin(), ve.rend()); vector < bool > vis(n, 0); ll res = 0 ; for(int i = 0 ; i < n ; i++) { if(vis[i]) continue ; vis[i] = 1; ll x = ve[i].first , y = ve[i].second ; for(int j = i + 1 ; j < n ; j++){ if(vis[j]) continue ; if(ve[j].second <= y) continue ; ll x1 = ve[j].first , y1 = ve[j].second ; if(x * y1 * 4 <= 4 * x * y + 4 * x1 * y1) { y = y1; } } res += (4 * x * y); for(int j = 0 ; j < n ; j++){ if(vis[j]) continue ; if(ve[j].second <= y) vis[j] = 1; } } cout << res << endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...