結果

問題 No.1726 [Cherry 3rd Tune B] ジャマイカビアポン
ユーザー 👑 kmjpkmjp
提出日時 2022-01-01 23:10:40
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2,916 ms / 3,000 ms
コード長 1,281 bytes
コンパイル時間 2,076 ms
コンパイル使用メモリ 207,112 KB
実行使用メモリ 43,516 KB
最終ジャッジ日時 2023-09-13 09:30:46
合計ジャッジ時間 44,017 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 4 ms
4,376 KB
testcase_05 AC 4 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 4 ms
4,380 KB
testcase_12 AC 7 ms
4,380 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 326 ms
12,020 KB
testcase_15 AC 1,377 ms
26,772 KB
testcase_16 AC 2,072 ms
34,920 KB
testcase_17 AC 1,336 ms
26,052 KB
testcase_18 AC 1,063 ms
21,872 KB
testcase_19 AC 1,859 ms
31,576 KB
testcase_20 AC 447 ms
13,600 KB
testcase_21 AC 1,680 ms
29,956 KB
testcase_22 AC 674 ms
17,560 KB
testcase_23 AC 718 ms
18,376 KB
testcase_24 AC 2,745 ms
43,284 KB
testcase_25 AC 2,779 ms
43,272 KB
testcase_26 AC 2,733 ms
43,516 KB
testcase_27 AC 2,865 ms
43,276 KB
testcase_28 AC 2,834 ms
43,280 KB
testcase_29 AC 2,817 ms
43,476 KB
testcase_30 AC 2,832 ms
43,280 KB
testcase_31 AC 2,860 ms
43,512 KB
testcase_32 AC 2,916 ms
43,480 KB
testcase_33 AC 2,789 ms
43,316 KB
testcase_34 AC 1 ms
4,380 KB
testcase_35 AC 2 ms
4,376 KB
testcase_36 AC 1 ms
4,380 KB
testcase_37 AC 1 ms
4,376 KB
testcase_38 AC 132 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define FORR2(x,y,arr) for(auto& [x,y]:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
template<class T> bool chmax(T &a, const T &b) { if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a, const T &b) { if(a>b){a=b;return 1;}return 0;}
//-------------------------------------------------------

int N,M;
int P[808];
int X[808],Y[808];
int S[808],T[808];

map<ll,ll> C;
void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>M;
	FOR(i,N) cin>>P[i];
	FOR(i,N) cin>>X[i]>>Y[i];
	FOR(i,M) cin>>S[i]>>T[i];
	ll ma=0;
	FOR(k,4) {
		if(k==2) {
			FOR(i,M) S[i]=-S[i];
		}
		if(k==1||k==3) {
			FOR(i,M) T[i]=-T[i];
		}
		C.clear();
		FOR(x,N) FOR(y,M) {
			i=X[x]-S[y];
			j=Y[x]-T[y];
			ll a=(((ll)i)<<31)+j;
			C[a]+=P[x];
		}
		FORR2(a,b,C) ma=max(ma,b);
	}
	cout<<ma<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}
0