結果
| 問題 |
No.1726 [Cherry 3rd Tune B] ジャマイカビアポン
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-11-06 00:55:39 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,021 bytes |
| コンパイル時間 | 1,224 ms |
| コンパイル使用メモリ | 98,640 KB |
| 実行使用メモリ | 13,640 KB |
| 最終ジャッジ日時 | 2024-11-06 17:49:09 |
| 合計ジャッジ時間 | 7,675 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 15 TLE * 1 -- * 23 |
コンパイルメッセージ
main.cpp:11:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
11 | main()
| ^~~~
ソースコード
#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];
map<int,int>mp;
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)
{
mp.clear();
for(int i=0;i<M;i++)
{
long nx=A[i]+(long)nd;
if(nx<-(int)1e9||(int)1e9<nx||XY.find(nx)==XY.end())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;
}