結果
問題 | No.2329 Nafmo、イカサマをする |
ユーザー |
|
提出日時 | 2023-04-22 17:30:45 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 511 bytes |
コンパイル時間 | 2,129 ms |
コンパイル使用メモリ | 200,288 KB |
最終ジャッジ日時 | 2025-02-12 13:06:25 |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 RE * 1 |
other | AC * 7 WA * 22 RE * 11 |
ソースコード
#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); 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; }