結果

問題 No.1726 [Cherry 3rd Tune B] ジャマイカビアポン
ユーザー SSRSSSRS
提出日時 2021-10-29 21:51:36
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 937 bytes
コンパイル時間 1,842 ms
コンパイル使用メモリ 176,276 KB
実行使用メモリ 48,512 KB
最終ジャッジ日時 2024-10-07 10:56:59
合計ジャッジ時間 26,503 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 29 TLE * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
  int N, M;
  cin >> N >> M;
  vector<int> P(N);
  for (int i = 0; i < N; i++){
    cin >> P[i];
  }
  vector<int> a(N), b(N);
  for (int i = 0; i < N; i++){
    cin >> a[i] >> b[i];
  }
  vector<int> c(M), d(M);
  for (int i = 0; i < M; i++){
    cin >> c[i] >> d[i];
  }
  int ans = 0;
  for (int i = 0; i < 2; i++){
    for (int j = 0; j < 2; j++){
      map<pair<int, int>, int> mp2;
      for (int k = 0; k < M; k++){
        for (int l = 0; l < N; l++){
          int x;
          if (i == 0){
            x = a[l] - c[k];
          } else {
            x = a[l] + c[k];
          }
          int y;
          if (j == 0){
            y = b[l] - d[k];
          } else {
            y  = b[l] + d[k];
          }
          mp2[make_pair(x, y)] += P[l];
        }
      }
      for (auto p : mp2){
        ans = max(ans, p.second);
      }
    }
  }
  cout << ans << endl;
}
0