Submission #163877

# Submission time Handle Problem Language Result Execution time Memory
163877 2019-11-15T22:19:15 Z YazanZk Cover (COCI18_cover) C++14
36 / 120
4 ms 632 KB
#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 time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Incorrect 3 ms 376 KB Output isn't correct
5 Incorrect 2 ms 376 KB Output isn't correct
6 Incorrect 2 ms 376 KB Output isn't correct
7 Incorrect 2 ms 376 KB Output isn't correct
8 Incorrect 2 ms 376 KB Output isn't correct
9 Incorrect 3 ms 500 KB Output isn't correct
10 Incorrect 4 ms 632 KB Output isn't correct