結果
問題 |
No.1726 [Cherry 3rd Tune B] ジャマイカビアポン
|
ユーザー |
👑 ![]() |
提出日時 | 2021-10-29 02:57:42 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2,713 ms / 3,000 ms |
コード長 | 792 bytes |
コンパイル時間 | 3,997 ms |
コンパイル使用メモリ | 299,972 KB |
実行使用メモリ | 55,380 KB |
最終ジャッジ日時 | 2024-10-07 09:20:26 |
合計ジャッジ時間 | 27,476 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 39 |
ソースコード
#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; }