結果

問題 No.2329 Nafmo、イカサマをする
ユーザー 👑 Nafmo2Nafmo2
提出日時 2023-04-22 17:30:45
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 511 bytes
コンパイル時間 2,280 ms
コンパイル使用メモリ 207,208 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-30 02:58:05
合計ジャッジ時間 4,978 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 WA -
testcase_04 AC 2 ms
5,376 KB
testcase_05 RE -
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 RE -
testcase_09 WA -
testcase_10 WA -
testcase_11 RE -
testcase_12 RE -
testcase_13 WA -
testcase_14 WA -
testcase_15 RE -
testcase_16 WA -
testcase_17 RE -
testcase_18 WA -
testcase_19 AC 2 ms
5,376 KB
testcase_20 RE -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 RE -
testcase_27 RE -
testcase_28 WA -
testcase_29 AC 2 ms
5,376 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 RE -
testcase_36 WA -
testcase_37 RE -
testcase_38 WA -
testcase_39 WA -
testcase_40 AC 3 ms
5,376 KB
testcase_41 WA -
testcase_42 AC 3 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0