結果

問題 No.2329 Nafmo、イカサマをする
ユーザー FplusFplusFFplusFplusF
提出日時 2023-05-28 15:32:01
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 921 bytes
コンパイル時間 2,174 ms
コンパイル使用メモリ 200,240 KB
最終ジャッジ日時 2025-02-13 13:31:24
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14 WA * 26
権限があれば一括ダウンロードができます

ソースコード

diff #
プレゼンテーションモードにする

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll,ll>;
const ll INF=(1ll<<60);
#define rep(i,n) for (ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(),v.end()
template<class T> void chmin(T &a,T b){
if(a>b){
a=b;
}
}
template<class T> void chmax(T &a,T b){
if(a<b){
a=b;
}
}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
ll n,m,k;
cin >> n >> m >> k;
vector<ll> a(n);
rep(i,n) cin >> a[i];
a.push_back(0);
vector<ll> v;
rep(i,n+1){
rep(j,n+1){
rep(k,n+1){
v.push_back(a[i]+a[j]+a[k]);
}
}
}
ll ans=0;
sort(all(v));
for(auto &i:v){
if(m<i) continue;
auto itr=upper_bound(all(v),m-i);
if(itr!=v.begin()) itr--;
if(i+(*itr)<=m) chmax(ans,i+(*itr));
}
cout << ans << '\n';
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0