結果

問題 No.2315 Flying Camera
ユーザー ococonomy1ococonomy1
提出日時 2023-05-26 21:21:47
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,463 bytes
コンパイル時間 969 ms
コンパイル使用メモリ 107,572 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-08-26 09:49:18
合計ジャッジ時間 4,490 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
4,376 KB
testcase_01 AC 4 ms
4,376 KB
testcase_02 AC 7 ms
4,380 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 2 ms
4,376 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

//#pragma GCC target("avx2")
//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <cassert>
#include <cmath>
#include <tuple>
#include <queue>
#include <bitset>
#include <complex>
#define _USE_MATH_DEFINES
#include <math.h>
using namespace std;
using lg = long long;
using pii = pair<int, int>;
using pll = pair<lg, lg>;
#define TEST clog << "TEST" << endl
#define IINF 2147483647
#define LLINF 9223372036854775807LL
#define AMARI 998244353
//#define AMARI 1000000007
#define TEMOTO ((sizeof(long double) == 16) ? false : true)
#define TIME_LIMIT 1980 * (TEMOTO ? 1 : 1000)
#define el '\n'
#define El '\n'

#define MULTI_TEST_CASE false
void solve(void) {
    int n;
    lg ans = LLINF;
    cin >> n;
    vector<int> x(n),y(n);
    for (int i = 0; i < n; i++)cin >> x[i];
    for (int i = 0; i < n; i++)cin >> y[i];
    for (int i = -300; i <= 300; i++) {
        for (int j = -300; j <= 300; j++) {
            lg temp = 0;
            for (int k = 0; k < n; k++)temp += abs(i - x[k]) + abs(j - y[k]);
            ans = min(ans, temp);
        }
    }
    cout << ans << el;
    return;
}

void calc(void) {
    return;
}

int main(void) {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    calc();
    int t = 1;
    if (MULTI_TEST_CASE)cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}
0