結果

問題 No.1726 [Cherry 3rd Tune B] ジャマイカビアポン
ユーザー 👑 tatyamtatyam
提出日時 2021-10-29 02:57:42
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2,692 ms / 3,000 ms
コード長 792 bytes
コンパイル時間 4,885 ms
コンパイル使用メモリ 331,512 KB
実行使用メモリ 55,260 KB
最終ジャッジ日時 2024-04-16 13:51:38
合計ジャッジ時間 30,086 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,248 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 3 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 3 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 4 ms
5,376 KB
testcase_12 AC 7 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 158 ms
14,416 KB
testcase_15 AC 647 ms
28,184 KB
testcase_16 AC 994 ms
31,684 KB
testcase_17 AC 618 ms
28,880 KB
testcase_18 AC 466 ms
25,176 KB
testcase_19 AC 834 ms
33,284 KB
testcase_20 AC 171 ms
15,348 KB
testcase_21 AC 753 ms
28,392 KB
testcase_22 AC 245 ms
16,632 KB
testcase_23 AC 272 ms
17,156 KB
testcase_24 AC 1,583 ms
52,352 KB
testcase_25 AC 1,645 ms
49,280 KB
testcase_26 AC 1,628 ms
48,812 KB
testcase_27 AC 1,638 ms
49,572 KB
testcase_28 AC 1,603 ms
52,316 KB
testcase_29 AC 1,628 ms
54,176 KB
testcase_30 AC 1,667 ms
55,260 KB
testcase_31 AC 1,667 ms
52,824 KB
testcase_32 AC 1,617 ms
47,476 KB
testcase_33 AC 1,584 ms
54,404 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 2,692 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
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(auto [s, t] : vector<pair<int, int>>{{1, 1}, {1, -1}, {-1, 1}, {-1, -1}}){
        __gnu_pbds::cc_hash_table<uint64_t, int> cnt;
        for(int i = 0; i < N; i++){
            auto [a, b] = A[i];
            for(auto [c, d] : B) cnt[uint64_t(c - s * a) << 32 ^ (d - t * b)] += P[i];
        }
        for(auto [key, val] : cnt) chmax(ans, val);
    }
    cout << ans << endl;
}
0