結果

問題 No.1726 [Cherry 3rd Tune B] ジャマイカビアポン
ユーザー kotatsugamekotatsugame
提出日時 2021-11-06 00:51:30
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 985 bytes
コンパイル時間 983 ms
コンパイル使用メモリ 96,892 KB
実行使用メモリ 35,228 KB
最終ジャッジ日時 2024-04-24 10:10:01
合計ジャッジ時間 5,972 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
35,228 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 6 ms
5,376 KB
testcase_05 AC 6 ms
5,376 KB
testcase_06 AC 7 ms
5,376 KB
testcase_07 AC 3 ms
5,376 KB
testcase_08 AC 3 ms
5,376 KB
testcase_09 AC 4 ms
5,376 KB
testcase_10 AC 4 ms
5,376 KB
testcase_11 AC 11 ms
5,376 KB
testcase_12 AC 13 ms
5,376 KB
testcase_13 AC 3 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 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:11:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   11 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
using namespace std;
int N,M;
int P[800];
int X[800],A[800],B[800];
map<int,vector<pair<int,int> > >XY;
int ans;
main()
{
	cin>>N>>M;
	for(int i=0;i<N;i++)cin>>P[i];
	for(int i=0;i<N;i++)
	{
		int x,y;cin>>x>>y;
		X[i]=x;
		XY[x].push_back(make_pair(y,P[i]));
	}
	for(int i=0;i<M;i++)cin>>A[i]>>B[i];
	for(int x=0;x<2;x++)
	{
		for(int y=0;y<2;y++)
		{
			vector<int>d;
			for(int i=0;i<N;i++)for(int j=0;j<M;j++)
			{
				d.push_back(X[i]-A[j]);
			}
			sort(d.begin(),d.end());
			d.erase(unique(d.begin(),d.end()),d.end());
			for(int nd:d)
			{
				map<int,int>mp;
				for(int i=0;i<M;i++)
				{
					long nx=A[i]+(long)nd;
					if(nx<-(int)1e9||(int)1e9<nx)continue;
					for(pair<int,int>p:XY[nx])
					{
						mp[p.first-B[i]]+=p.second;
					}
				}
				for(pair<int,int>p:mp)if(ans<p.second)ans=p.second;
			}
			for(int i=0;i<M;i++)B[i]=-B[i];
		}
		for(int i=0;i<M;i++)A[i]=-A[i];
	}
	cout<<ans<<endl;
}
0