結果

問題 No.1726 [Cherry 3rd Tune B] ジャマイカビアポン
ユーザー ktr216ktr216
提出日時 2021-10-29 23:22:38
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 980 bytes
コンパイル時間 1,818 ms
コンパイル使用メモリ 172,396 KB
実行使用メモリ 10,400 KB
最終ジャッジ日時 2024-04-16 15:56:21
合計ジャッジ時間 6,652 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
8,448 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 3 ms
5,376 KB
testcase_04 AC 14 ms
5,376 KB
testcase_05 AC 14 ms
5,376 KB
testcase_06 AC 4 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 3 ms
5,376 KB
testcase_09 AC 5 ms
5,376 KB
testcase_10 AC 6 ms
5,376 KB
testcase_11 AC 24 ms
5,376 KB
testcase_12 AC 66 ms
5,376 KB
testcase_13 AC 3 ms
5,376 KB
testcase_14 TLE -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, l, r) for (int i = (l); i < (r); i++)
using namespace std;

typedef long long ll;

int main() {
    int N, M, ans = 0;
    cin >> N >> M;
    vector<int> P(N), a(N), b(N), c(M), d(M);
    rep(i, 0, N) cin >> P[i];
    map<pair<int, int>, int> mp;
    rep(i, 0, N) {
        cin >> a[i] >> b[i];
        mp[make_pair(a[i], b[i])] = P[i];
    }
    rep(i, 0, M) cin >> c[i] >> d[i];
    rep(i, 0, 4) {
        if (i % 2) {
            rep(j, 0, M) c[j] *= -1;
        }
        if (i == 2) {
            rep(j, 0, M) d[j] *= -1;
        }
        rep(j, 0, N) {
            rep(k, 0, M) {
                int dx = a[j] - c[k], dy = b[j] - d[k], s = 0;
                rep(l, 0, M) {
                    if (mp.find(make_pair(c[l] + dx, d[l] + dy)) == mp.end()) continue;
                    s += mp[make_pair(c[l] + dx, d[l] + dy)];
                }
                ans = max(ans, s);
            }
        }
    }
    cout << ans << endl;
}
0