結果

問題 No.1726 [Cherry 3rd Tune B] ジャマイカビアポン
ユーザー fumofumofunifumofumofuni
提出日時 2021-10-29 22:23:43
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2,118 ms / 3,000 ms
コード長 1,832 bytes
コンパイル時間 2,526 ms
コンパイル使用メモリ 209,804 KB
実行使用メモリ 30,848 KB
最終ジャッジ日時 2024-04-16 15:14:13
合計ジャッジ時間 32,656 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 2 ms
5,376 KB
testcase_04 AC 4 ms
5,376 KB
testcase_05 AC 4 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 2 ms
5,376 KB
testcase_10 AC 3 ms
5,376 KB
testcase_11 AC 4 ms
5,376 KB
testcase_12 AC 7 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 285 ms
9,600 KB
testcase_15 AC 1,011 ms
18,816 KB
testcase_16 AC 1,476 ms
26,240 KB
testcase_17 AC 989 ms
18,560 KB
testcase_18 AC 748 ms
16,384 KB
testcase_19 AC 1,312 ms
25,216 KB
testcase_20 AC 324 ms
10,112 KB
testcase_21 AC 1,195 ms
23,168 KB
testcase_22 AC 537 ms
14,208 KB
testcase_23 AC 575 ms
14,464 KB
testcase_24 AC 1,995 ms
30,464 KB
testcase_25 AC 1,950 ms
30,336 KB
testcase_26 AC 1,921 ms
30,464 KB
testcase_27 AC 1,926 ms
30,336 KB
testcase_28 AC 1,936 ms
30,720 KB
testcase_29 AC 1,912 ms
30,720 KB
testcase_30 AC 1,936 ms
30,464 KB
testcase_31 AC 1,898 ms
30,336 KB
testcase_32 AC 2,118 ms
30,464 KB
testcase_33 AC 1,888 ms
30,848 KB
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 60 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=(n)-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,1,0,-1,1,-1,1,-1};
template <typename T> inline bool chmax(T &a, T b) {
  return ((a < b) ? (a = b, true) : (false));
}
template <typename T> inline bool chmin(T &a, T b) {
  return ((a > b) ? (a = b, true) : (false));
}
ll n,m;
vl p;
vector<unordered_map<ll,ll>> mp(800);
ll calc(vpl v,vpl to){
  rep(i,800)mp[i].clear();
  rep(i,n){
    rep(j,m){
      pl q={v[i].first-to[j].first,v[i].second-to[j].second};
      ll x=((q.first%800)+800)%800;
      q.second+=2e9;
      q.second*=1e9;
      q.first+=2e9;
      q.first/=800;
      q.second+=q.first;
      mp[x][q.second]+=p[i];
    }
  }
  ll ans=0;
  for(auto q:mp){
    for(auto t:q){
      chmax(ans,t.second);
    }
  }
  return ans;
}
int main(){
  cin >> n >> m;
  p.resize(n);
  rep(i,n)cin >> p[i];
  vpl a(n),b(m);
  rep(i,n){
    ll x,y;cin >> x >> y;a[i]={x,y};
  }
  rep(i,m){
    ll x,y;cin >> x >> y;b[i]={x,y};
  }
  ll ans=0;
  chmax(ans,calc(a,b));
  rep(i,n)a[i].first*=-1;
  chmax(ans,calc(a,b));
  rep(i,n)a[i].second*=-1;
  chmax(ans,calc(a,b));
  rep(i,n)a[i].first*=-1;
  chmax(ans,calc(a,b));
  cout << ans << endl;
}
0