結果

問題 No.1874 Minimum of Sum of Rectangles
ユーザー shiomusubi496
提出日時 2022-02-27 11:42:29
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 471 bytes
コンパイル時間 2,922 ms
コンパイル使用メモリ 193,828 KB
最終ジャッジ日時 2025-01-28 03:41:01
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 5 TLE * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

using ll = long long;

int main() {
    int N; cin >> N;
    vector<ll> X(N), Y(N);
    for (int i=0; i<N; i++) cin >> X[i] >> Y[i];
    ll ans = 1e18;
    for (int i=0; i<N; i++) {
        for (int j=0; j<N; j++) {
            ll p = X[i], q = Y[j];
            ll sum = 0;
            for (int k=0; k<N; k++) sum += abs(X[k] - p) * abs(Y[k] - q);
            ans = min(ans, sum);
        }
    }
    cout << ans << endl;
}
0