結果

問題 No.1726 [Cherry 3rd Tune B] ジャマイカビアポン
ユーザー kotatsugamekotatsugame
提出日時 2021-11-06 03:13:18
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 263 ms / 3,000 ms
コード長 796 bytes
コンパイル時間 712 ms
コンパイル使用メモリ 80,228 KB
実行使用メモリ 17,428 KB
最終ジャッジ日時 2024-04-24 12:34:31
合計ジャッジ時間 5,995 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 1 ms
6,944 KB
testcase_04 AC 3 ms
6,940 KB
testcase_05 AC 3 ms
6,944 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 1 ms
6,940 KB
testcase_08 AC 2 ms
6,940 KB
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 2 ms
6,944 KB
testcase_11 AC 3 ms
6,944 KB
testcase_12 AC 4 ms
6,940 KB
testcase_13 AC 1 ms
6,940 KB
testcase_14 AC 55 ms
6,940 KB
testcase_15 AC 159 ms
10,080 KB
testcase_16 AC 224 ms
11,400 KB
testcase_17 AC 161 ms
10,924 KB
testcase_18 AC 132 ms
11,024 KB
testcase_19 AC 201 ms
11,528 KB
testcase_20 AC 67 ms
7,260 KB
testcase_21 AC 187 ms
11,332 KB
testcase_22 AC 92 ms
6,944 KB
testcase_23 AC 101 ms
7,136 KB
testcase_24 AC 262 ms
16,324 KB
testcase_25 AC 255 ms
16,264 KB
testcase_26 AC 256 ms
17,428 KB
testcase_27 AC 254 ms
16,156 KB
testcase_28 AC 255 ms
16,448 KB
testcase_29 AC 254 ms
16,208 KB
testcase_30 AC 252 ms
15,916 KB
testcase_31 AC 259 ms
16,368 KB
testcase_32 AC 262 ms
16,136 KB
testcase_33 AC 263 ms
16,384 KB
testcase_34 AC 2 ms
6,944 KB
testcase_35 AC 2 ms
6,944 KB
testcase_36 AC 2 ms
6,944 KB
testcase_37 AC 2 ms
6,944 KB
testcase_38 AC 155 ms
16,272 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:9:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    9 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int N,M;
int P[800];
int X[800],Y[800],A[800],B[800];
int ans;
main()
{
	cin>>N>>M;
	for(int i=0;i<N;i++)cin>>P[i];
	for(int i=0;i<N;i++)cin>>X[i]>>Y[i];
	for(int i=0;i<M;i++)cin>>A[i]>>B[i];
	vector<pair<pair<int,int>,int> >now;
	for(int x=0;x<2;x++)
	{
		for(int y=0;y<2;y++)
		{
			now.clear();
			for(int i=0;i<N;i++)for(int j=0;j<M;j++)
			{
				now.push_back(make_pair(make_pair(X[i]-A[j],Y[i]-B[j]),P[i]));
			}
			sort(now.begin(),now.end());
			for(int i=0;i<now.size();)
			{
				int j=i;
				int sum=0;
				while(j<now.size()&&now[i].first==now[j].first)sum+=now[j++].second;
				ans=max(ans,sum);
				i=j;
			}
			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