結果
| 問題 |
No.2329 Nafmo、イカサマをする
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-04-22 17:42:00 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 513 bytes |
| コンパイル時間 | 2,000 ms |
| コンパイル使用メモリ | 198,688 KB |
| 最終ジャッジ日時 | 2025-02-12 13:06:34 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 9 WA * 31 |
ソースコード
#include<bits/stdc++.h>
typedef long long int ll;
#define REP(i,n) for(int i=0;i<signed(n);i++)
using namespace std;
ll ans;
int main(){
ll N,M,ans=0;
cin>>N>>M;
vector<ll> A(N+1);
set<ll> sum;
REP(i,N)cin>>A[i];
A[N]=0;
REP(i,N+1){
for(int j=i;j<N+1;j++){
if(A[i]+A[j]<=M){
sum.insert(A[i]+A[j]);
}
}
}
for(auto x:sum){
auto it=--sum.upper_bound(M-x);
ans=max(x+(*it),ans);
}
cout<<ans<<endl;
}