提出 #20357539


ソースコード 拡げる

#include <bits/stdc++.h>
#define ll long long
using namespace std;

const int INF = -2e9;
int dp[101][101][101];

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n,y;
    ll x,ans=1e18;
    cin>>n>>x;
    for (int i=0;i<101;++i)
    {
        for (int j=0;j<101;++j)
            for (int k=0;k<101;++k)
                dp[i][j][k]=INF;
        dp[i][0][0]=0;
    }
    for (int z=0;z<n;++z)
    {
        cin>>y;
        for (int i=1;i<=n;++i)
            for (int j=i;j;--j)
                for (int k=0;k<i;++k)
                    dp[i][j][k]=max(dp[i][j][k],dp[i][j-1][(((k-y)%i)+i)%i]+y);
    }
    for (int i=1;i<=n;++i)
        if (dp[i][i][x%i]>0)
            ans=min({ans,(x-dp[i][i][x%i])/i});
    cout<<ans;
    return 0;
}

提出情報

提出日時
問題 F - Potion
ユーザ ScarletS
言語 C++ (GCC 9.2.1)
得点 600
コード長 786 Byte
結果 AC
実行時間 192 ms
メモリ 7620 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 600 / 600
結果
AC × 2
AC × 34
セット名 テストケース
Sample sample_01.txt, sample_02.txt
All hand_01.txt, hand_02.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, sample_01.txt, sample_02.txt, special_01.txt, special_02.txt, special_03.txt, special_04.txt, special_05.txt, special_06.txt, special_07.txt, special_08.txt, special_09.txt, special_10.txt
ケース名 結果 実行時間 メモリ
hand_01.txt AC 191 ms 7540 KiB
hand_02.txt AC 187 ms 7528 KiB
random_01.txt AC 185 ms 7532 KiB
random_02.txt AC 7 ms 7620 KiB
random_03.txt AC 192 ms 7464 KiB
random_04.txt AC 27 ms 7596 KiB
random_05.txt AC 192 ms 7520 KiB
random_06.txt AC 155 ms 7600 KiB
random_07.txt AC 188 ms 7540 KiB
random_08.txt AC 6 ms 7596 KiB
random_09.txt AC 186 ms 7560 KiB
random_10.txt AC 10 ms 7468 KiB
random_11.txt AC 191 ms 7524 KiB
random_12.txt AC 10 ms 7520 KiB
random_13.txt AC 192 ms 7572 KiB
random_14.txt AC 26 ms 7476 KiB
random_15.txt AC 188 ms 7524 KiB
random_16.txt AC 17 ms 7516 KiB
random_17.txt AC 191 ms 7528 KiB
random_18.txt AC 8 ms 7596 KiB
random_19.txt AC 190 ms 7532 KiB
random_20.txt AC 8 ms 7560 KiB
sample_01.txt AC 8 ms 7516 KiB
sample_02.txt AC 7 ms 7580 KiB
special_01.txt AC 186 ms 7524 KiB
special_02.txt AC 189 ms 7596 KiB
special_03.txt AC 189 ms 7560 KiB
special_04.txt AC 187 ms 7464 KiB
special_05.txt AC 188 ms 7564 KiB
special_06.txt AC 189 ms 7600 KiB
special_07.txt AC 187 ms 7584 KiB
special_08.txt AC 190 ms 7564 KiB
special_09.txt AC 189 ms 7524 KiB
special_10.txt AC 187 ms 7596 KiB