結果

問題 No.1726 [Cherry 3rd Tune B] ジャマイカビアポン
ユーザー 👑 tatyam
提出日時 2021-10-16 19:30:52
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 1,380 ms / 3,000 ms
コード長 843 bytes
コンパイル時間 2,991 ms
コンパイル使用メモリ 256,856 KB
実行使用メモリ 33,148 KB
最終ジャッジ日時 2024-10-07 09:16:55
合計ジャッジ時間 22,263 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 39
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
void chmax(int& a, int b){ if(a < b) a = b; }

int main(){
    int N, M;
    cin >> N >> M;
    vector<int> P(N);
    for(int& p : P) cin >> p;
    int ans = 0;
    vector<pair<int, int>> A(N), B(M);
    for(auto& [a, b] : A) cin >> a >> b;
    for(auto& [c, d] : B) cin >> c >> d;
    for(int i = 0; i < 2; i++){
        for(auto& [a, b] : A) a = -a;
        for(int i = 0; i < 2; i++){
            for(auto& [a, b] : A) b = -b;
            unordered_map<i64, int> cnt;
            for(int i = 0; i < N; i++){
                auto [a, b] = A[i];
                for(auto [c, d] : B){
                    cnt[i64(a - c) << 32 ^ (b - d)] += P[i];
                }
            }
            for(auto [key, val] : cnt) chmax(ans, val);
        }
    }
    cout << ans << endl;
}
0