답안 #440125

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
440125 2021-07-01T15:50:51 Z julian33 Cover (COCI18_cover) C++14
36 / 120
3 ms 460 KB
#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#define deb(...) logger(#__VA_ARGS__, __VA_ARGS__)
template<typename ...Args>
void logger(string vars, Args&&... values) {
    cerr<<vars<<" = ";
    string delim="";
    (...,(cerr<<delim<<values,delim=", "));
    cerr<<"\n";
}
#else
#define deb(...) logger(#__VA_ARGS__, __VA_ARGS__)
template<typename ...Args>
void logger(string vars, Args&&... values) {}
#endif

#define pb push_back
#define sz(x) (int)(x.size())
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<typename T> inline void maxa(T& a,T b){a=max(a,b);}
template<typename T> inline void mina(T& a,T b){a=min(a,b);} 

int main(){
    cin.sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    #ifdef LOCAL
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif

    vector<pll> pts;
    int n; cin>>n;
    for(int i=0;i<n;i++){
        int x,y; cin>>x>>y;
        pts.pb({abs(x),abs(y)});
    }
    ll ans=0;
    sort(pts.rbegin(),pts.rend());
    ll cx=pts[0].first;
    ll cy=pts[0].second;
    for(int i=1;i<n;i++){
        if(4*pts[i].first*pts[i].second+4*cx*cy<4*max(cx,pts[i].first)*max(cy,pts[i].second)){
            ans+=4*cx*cy;
            cx=pts[i].first;
            cy=pts[i].second;
        } else{
            maxa(cx,pts[i].first);
            maxa(cy,pts[i].second);
        }
    }
    cout<<ans+4*cx*cy<<"\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Incorrect 1 ms 204 KB Output isn't correct
5 Incorrect 1 ms 204 KB Output isn't correct
6 Incorrect 1 ms 204 KB Output isn't correct
7 Incorrect 1 ms 204 KB Output isn't correct
8 Incorrect 1 ms 332 KB Output isn't correct
9 Incorrect 2 ms 332 KB Output isn't correct
10 Incorrect 3 ms 460 KB Output isn't correct