結果

問題 No.1726 [Cherry 3rd Tune B] ジャマイカビアポン
ユーザー cureskolcureskol
提出日時 2021-10-29 22:26:19
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 799 bytes
コンパイル時間 2,423 ms
コンパイル使用メモリ 181,092 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-04-16 15:17:26
合計ジャッジ時間 7,369 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
8,320 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 21 ms
5,376 KB
testcase_05 AC 29 ms
5,376 KB
testcase_06 AC 3 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 3 ms
5,376 KB
testcase_09 AC 6 ms
5,376 KB
testcase_10 AC 6 ms
5,376 KB
testcase_11 AC 14 ms
5,376 KB
testcase_12 AC 84 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 TLE -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;

#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n-1);i>=0;i--)
#define ALL(v) v.begin(),v.end()

template<typename T>
bool chmax(T &a,T b){
  return (a<b&&(a=b,true));
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  
  int n,m;cin>>n>>m;
  vector<int> v(n);
  REP(i,n)cin>>v[i];
  vector<int> a(n),b(n),c(m),d(m);
  REP(i,n)cin>>a[i]>>b[i];
  REP(j,m)cin>>c[j]>>d[j];
  set<tuple<int,int>> se;
  REP(j,m)se.insert({c[j],d[j]});
  int ans=0;
  REP(_,4){
    REP(i,n)REP(j,m){
      int X=c[j]-a[i],Y=d[j]-b[i],res=0;
      REP(ii,n)if(se.count({a[ii]+X,b[ii]+Y}))res+=v[ii];
      chmax(ans,res);
    }
    REP(i,n)a[i]*=-1;
    if(_==1)REP(i,n)b[i]*=-1;
  }
  cout<<ans<<endl;
}
  
0