結果
問題 |
No.1726 [Cherry 3rd Tune B] ジャマイカビアポン
|
ユーザー |
|
提出日時 | 2021-11-06 00:51:30 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 985 bytes |
コンパイル時間 | 1,120 ms |
コンパイル使用メモリ | 97,924 KB |
実行使用メモリ | 10,496 KB |
最終ジャッジ日時 | 2024-11-06 17:43:01 |
合計ジャッジ時間 | 6,385 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 14 TLE * 1 -- * 24 |
コンパイルメッセージ
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]; 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; }