結果

問題 No.1726 [Cherry 3rd Tune B] ジャマイカビアポン
ユーザー 👑 KazunKazun
提出日時 2021-08-09 21:45:43
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,985 ms / 3,000 ms
コード長 1,007 bytes
コンパイル時間 1,888 ms
コンパイル使用メモリ 171,136 KB
実行使用メモリ 33,264 KB
最終ジャッジ日時 2024-04-16 13:30:22
合計ジャッジ時間 26,461 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 AC 3 ms
5,376 KB
testcase_05 AC 4 ms
5,376 KB
testcase_06 AC 3 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 3 ms
5,376 KB
testcase_11 AC 3 ms
5,376 KB
testcase_12 AC 6 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 138 ms
9,528 KB
testcase_15 AC 926 ms
24,820 KB
testcase_16 AC 1,197 ms
28,672 KB
testcase_17 AC 871 ms
24,220 KB
testcase_18 AC 522 ms
16,612 KB
testcase_19 AC 1,030 ms
27,008 KB
testcase_20 AC 166 ms
10,560 KB
testcase_21 AC 944 ms
24,572 KB
testcase_22 AC 356 ms
14,568 KB
testcase_23 AC 361 ms
14,812 KB
testcase_24 AC 1,985 ms
30,424 KB
testcase_25 AC 1,756 ms
31,480 KB
testcase_26 AC 1,658 ms
32,888 KB
testcase_27 AC 1,570 ms
31,856 KB
testcase_28 AC 1,552 ms
31,480 KB
testcase_29 AC 1,568 ms
33,264 KB
testcase_30 AC 1,522 ms
31,736 KB
testcase_31 AC 1,600 ms
31,856 KB
testcase_32 AC 1,591 ms
31,740 KB
testcase_33 AC 1,541 ms
31,728 KB
testcase_34 AC 2 ms
5,376 KB
testcase_35 AC 2 ms
5,376 KB
testcase_36 AC 2 ms
5,376 KB
testcase_37 AC 2 ms
5,376 KB
testcase_38 AC 35 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

using ll=long long;

int max(int a, int b){
    if (a>b) return a;
    else return b;
}

int main(){
    int N,M;
    cin >> N >> M;
    
    vector<int> P(N);
    for (int i=0; i<N; i++) cin >> P[i];
    
    vector<int> a(N),b(N),c(M),d(M);

    for (int i=0; i<N; i++) cin >> a[i] >> b[i];

    for (int j=0; j<M; j++) cin >> c[j] >> d[j];

    int X=0;
    int u,v,s,t,x,y;
    ll msk=1<<31;

    for (int s=0; s<=1; s++){
        for (int i=0; i<N; i++){
            a[i]=-a[i];
        }

        for (int t=0; t<=1; t++){
            for (int i=0; i<N; i++){
                b[i]=-b[i];
            }

            unordered_map<ll, int> mp;
            for (int i=0; i<N; i++){
                for (int j=0; j<M; j++){
                    u=c[j]-a[i]; v=d[j]-b[i];
                    mp[u*msk^v]+=P[i];
                }
            }
            
            for (auto x: mp) X=max(X,x.second);
        }
    }

    cout << X << endl;

    return 0;
}
0