結果

問題 No.2329 Nafmo、イカサマをする
ユーザー MMMM
提出日時 2023-06-02 00:23:27
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 493 bytes
コンパイル時間 1,613 ms
コンパイル使用メモリ 172,236 KB
実行使用メモリ 11,936 KB
最終ジャッジ日時 2023-08-28 02:13:28
合計ジャッジ時間 5,227 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
	// input
	int N,K; ll M;
	cin >> N >> M >> K;
	vector<ll> A(N+1);
	for(int i = 0; i < N; i++) cin >> A[i];
	// prep
	set<ll> S;
	for(int i = 0; i <= N; i++)
	for(int j = 0; j <= N; j++)
	for(int k = 0; k <= N; k++)
	S.insert(A[i]+A[j]+A[k]);
	// solve
	ll ans = 0;
	for (auto idx : S){
		auto it = S.upper_bound(M-idx);
		it--;
		ll tmp = idx + *it;
		if(tmp <= M) ans = max(ans,tmp);
	}
	cout << ans << endl;
	
}
0