답안 #163877

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
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;
}
# 결과 실행 시간 메모리 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