結果

問題 No.2329 Nafmo、イカサマをする
ユーザー srpkdyy
提出日時 2023-05-28 15:57:39
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 854 bytes
コンパイル時間 5,098 ms
コンパイル使用メモリ 233,384 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-27 10:04:39
合計ジャッジ時間 5,420 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18 WA * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
#define rep(i, n) for (int i=0; i<(n); i++)
#define len(x) (int)(x).size()
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
using namespace std;
using namespace atcoder;
using ll = long long;
using mint9 = atcoder::modint998244353;
using mint10 = atcoder::modint1000000007;

int main() {
   ios::sync_with_stdio(false);
   cin.tie(0);

   ll N, M, K;
   cin >> N >> M >> K;
   vector<ll> A(N);
   rep(i, N) cin >> A[i];
   sort(all(A));

   vector<vector<ll>> dp(K, vector<ll>(N));
   rep(i, N) dp[0][i] = A[i];

   for (int k=1; k<K; k++) {
      rep(i, N) {
         rep(j, N) {
            if (A[i] + dp[k-1][j] <= M) {
               dp[k][i] = max(dp[k][i], A[i] + dp[k-1][j]);
            }
         }
      }
   }
   cout << *max_element(all(dp[K-1])) << endl;
   return 0;
}

0