結果
問題 | No.1726 [Cherry 3rd Tune B] ジャマイカビアポン |
ユーザー | milanis48663220 |
提出日時 | 2021-10-29 21:58:54 |
言語 | C++17 (gcc 13.2.0 + boost 1.83.0) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 2,039 bytes |
コンパイル時間 | 2,113 ms |
コンパイル使用メモリ | 129,388 KB |
実行使用メモリ | 43,648 KB |
最終ジャッジ日時 | 2024-04-16 14:51:06 |
合計ジャッジ時間 | 54,701 ms |
ジャッジサーバーID (参考情報) |
judge5 / 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 | 3 ms
5,376 KB |
testcase_04 | AC | 5 ms
5,376 KB |
testcase_05 | AC | 6 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 | 3 ms
5,376 KB |
testcase_10 | AC | 3 ms
5,376 KB |
testcase_11 | AC | 6 ms
5,376 KB |
testcase_12 | AC | 11 ms
5,376 KB |
testcase_13 | AC | 2 ms
5,376 KB |
testcase_14 | AC | 475 ms
12,160 KB |
testcase_15 | AC | 1,785 ms
26,880 KB |
testcase_16 | AC | 2,838 ms
35,200 KB |
testcase_17 | AC | 1,663 ms
26,240 KB |
testcase_18 | AC | 1,331 ms
22,016 KB |
testcase_19 | AC | 2,365 ms
31,616 KB |
testcase_20 | AC | 569 ms
13,696 KB |
testcase_21 | AC | 2,238 ms
30,336 KB |
testcase_22 | AC | 875 ms
17,536 KB |
testcase_23 | AC | 970 ms
18,432 KB |
testcase_24 | TLE | - |
testcase_25 | TLE | - |
testcase_26 | TLE | - |
testcase_27 | TLE | - |
testcase_28 | TLE | - |
testcase_29 | TLE | - |
testcase_30 | TLE | - |
testcase_31 | TLE | - |
testcase_32 | TLE | - |
testcase_33 | TLE | - |
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 | 300 ms
5,376 KB |
ソースコード
#include <iostream> #include <algorithm> #include <iomanip> #include <vector> #include <queue> #include <set> #include <map> #include <tuple> #include <cmath> #include <numeric> #include <functional> #include <cassert> #define debug_value(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << #x << "=" << x << endl; #define debug(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << x << endl; template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } using namespace std; typedef long long ll; using P = pair<int, int>; ll calc(vector<int> a, vector<int> b, vector<int> c, vector<int> d, vector<ll> p){ int n = a.size(), m = c.size(); map<P, ll> mp; for(int i = 0; i < n; i++){ for(int j = 0; j < m; j++){ int dx = c[j]-a[i]; int dy = d[j]-b[i]; // if(dx%2 == 0 && dy%2 == 0){ auto pt = P(dx, dy); if(mp.count(pt)){ mp[pt] += p[i]; }else{ mp[pt] = p[i]; } // } } } ll ans = 0; for(auto [p, x]: mp) { chmax(ans, x); // cout << p.first << ", " << p.second << ": " << x << endl; } return ans; } int main(){ ios::sync_with_stdio(false); cin.tie(0); cout << setprecision(10) << fixed; int n, m; cin >> n >> m; vector<ll> p(n); vector<int> a(n), b(n), c(m), d(m); for(int i = 0; i < n; i++) cin >> p[i]; for(int i = 0; i < n; i++) cin >> a[i] >> b[i]; for(int i = 0; i < m; i++) cin >> c[i] >> d[i]; ll ans = calc(a, b, c, d, p); for(int i = 0; i < n; i++) a[i] *= -1; chmax(ans, calc(a, b, c, d, p)); for(int i = 0; i < n; i++) a[i] *= -1; for(int i = 0; i < n; i++) b[i] *= -1; chmax(ans, calc(a, b, c, d, p)); for(int i = 0; i < n; i++) a[i] *= -1; chmax(ans, calc(a, b, c, d, p)); cout << ans << endl; }