結果
| 問題 |
No.1726 [Cherry 3rd Tune B] ジャマイカビアポン
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-10-29 22:59:42 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,633 bytes |
| コンパイル時間 | 2,120 ms |
| コンパイル使用メモリ | 209,524 KB |
| 最終ジャッジ日時 | 2025-01-25 09:23:42 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 15 WA * 4 TLE * 20 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
int N, M;
cin >> N >> M;
vector<long long> P(N);
for(int i = 0; i < N; i++) cin >> P[i];
vector<long long> a(N), b(N), c(M), d(M);
map<long long, int> m;
set<long long> s;
long long INF = 2000000000;
for(int i = 0; i < N; i++) {
cin >> a[i] >> b[i];
a[i] *= 2;
b[i] *= 2;
m[(a[i] + INF) * INF + b[i]] = i;
}
for(int i = 0; i < M; i++) {
cin >> c[i] >> d[i];
c[i] *= 2;
d[i] *= 2;
}
int ans = 0;
for(int i = 0; i < M; i++){
for(int j = 0; j < N; j++){
long long mx = (a[j] + c[i]) / 2;
long long my = (b[j] + d[i]) / 2;
if(s.count((mx + INF) * INF + my)) continue;
s.insert((mx + INF) * INF + my);
int res = 0, res2 = 0, res3 = 0, res4 = 0;
for(int k = 0; k < M; k++){
long long r = mx * 2 - c[k];
long long l = my * 2 - d[k];
if(m.count((r + INF) * INF + l)) {
res += P[m[(r + INF) * INF + l]];
}
if(m.count((r + INF) * INF + d[k])){
res2 += P[m[(r + INF) * INF + d[k]]];
}
if(m.count((c[k] + INF) * INF + l)){
res3 += P[m[(c[k] + INF) * INF + l]];
}
if(m.count((c[k] + INF) * INF + d[k])){
res4 += P[m[(c[k] + INF) * INF + d[k]]];
}
}
ans = max({ans, res, res2, res3, res4});
}
}
cout << ans << endl;
}