結果

問題 No.1726 [Cherry 3rd Tune B] ジャマイカビアポン
ユーザー nawawannawawan
提出日時 2021-10-29 23:08:31
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,755 bytes
コンパイル時間 2,666 ms
コンパイル使用メモリ 210,424 KB
実行使用メモリ 14,016 KB
最終ジャッジ日時 2024-04-16 15:47:08
合計ジャッジ時間 10,609 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
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 9 ms
5,376 KB
testcase_11 AC 26 ms
5,376 KB
testcase_12 WA -
testcase_13 AC 3 ms
5,376 KB
testcase_14 TLE -
testcase_15 TLE -
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>
using namespace std;
typedef unsigned long long ull;
int main(){
    int N, M;
    cin >> N >> M;
    vector<long long> P(N);
    for(int i = 0; i < N; i++) cin >> P[i];
    vector<long long> a(N), b(N), c(M), d(M);
    unordered_map<ull, int> m;
    unordered_set<ull> s;
    ull INF = 2000000000;
    for(int i = 0; i < N; i++) {
        cin >> a[i] >> b[i];
        a[i] *= 2;
        b[i] *= 2;
        m[(a[i] + INF) * INF + (b[i] + INF)] = i;
    }
    for(int i = 0; i < M; i++) {
        cin >> c[i] >> d[i];
        c[i] *= 2;
        d[i] *= 2;
    }
    int ans = 0;
    for(int i = 0; i < M; i++){
        for(int j = 0; j < N; j++){
            long long mx = (a[j] + c[i]) / 2;
            long long my = (b[j] + d[i]) / 2;
            if(s.count((mx + INF) * INF + (my + INF))) continue;
            s.insert((mx + INF) * INF + (my + INF));
            int res = 0, res2 = 0, res3 = 0, res4 = 0;
            for(int k = 0; k < M; k++){
                long long r = mx * 2 - c[k];
                long long l = my * 2 - d[k];
                if(m.count((r + INF) * INF + (l + INF))) {
                    res += P[m[(r + INF) * INF + (l + INF)]];
                }
                if(m.count((r + INF) * INF + (d[k] + INF))){
                    res2 += P[m[(r + INF) * INF + (d[k] + INF)]];
                }
                if(m.count((c[k] + INF) * INF + (l + INF))){
                    res3 += P[m[(c[k] + INF) * INF + (l + INF)]];
                }
                if(m.count((c[k] + INF) * INF + (d[k] + INF))){
                    res4 += P[m[(c[k] + INF) * INF + (d[k] + INF)]];
                }
            }
            ans = max({ans, res, res2, res3, res4});
        }
    }
    cout << ans << endl;
}
0