結果
問題 |
No.1726 [Cherry 3rd Tune B] ジャマイカビアポン
|
ユーザー |
|
提出日時 | 2021-11-06 03:13:18 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 317 ms / 3,000 ms |
コード長 | 796 bytes |
コンパイル時間 | 806 ms |
コンパイル使用メモリ | 79,896 KB |
実行使用メモリ | 17,616 KB |
最終ジャッジ日時 | 2024-11-06 20:27:56 |
合計ジャッジ時間 | 7,248 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 39 |
コンパイルメッセージ
main.cpp:9:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 9 | main() | ^~~~
ソースコード
#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; }