結果

問題 No.1726 [Cherry 3rd Tune B] ジャマイカビアポン
ユーザー SSRS
提出日時 2021-10-29 21:54:30
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 966 bytes
コンパイル時間 2,001 ms
コンパイル使用メモリ 180,484 KB
実行使用メモリ 100,004 KB
最終ジャッジ日時 2024-10-07 11:03:58
合計ジャッジ時間 21,703 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24 TLE * 1 -- * 14
権限があれば一括ダウンロードができます

ソースコード

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<int, map<int, int>> mp;
      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];
          }
          mp[x][y] += P[l];
        }
      }
      for (auto x : mp){
        for (auto y : x.second){
          ans = max(ans, y.second);
        }
      }
    }
  }
  cout << ans << endl;
}
0