# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
163875 | YazanZk | Cover (COCI18_cover) | C++14 | 4 ms | 632 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 * 2 <= 2 * x * y + 2 * x1 * y1) {
y = y1;
}
}
res += (2 * x * 2 * 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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |