結果

問題 No.1825 Except One
ユーザー asaringoasaringo
提出日時 2022-01-30 20:22:00
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 9 ms / 3,000 ms
コード長 1,124 bytes
コンパイル時間 1,719 ms
コンパイル使用メモリ 171,596 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-02 01:47:50
合計ジャッジ時間 3,999 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std ;
typedef long long ll ;
typedef long double ld ;
typedef pair<ll,ll> P ;
typedef tuple<bool,ll,ll,ll> TP ;
#define chmin(a,b) a = min(a,b)
#define chmax(a,b) a = max(a,b)
#define bit_count(x) __builtin_popcountll(x)
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) a / gcd(a,b) * b
#define rep(i,n) for(int i = 0 ; i < n ; i++)
#define rrep(i,a,b) for(int i = a ; i < b ; i++)
#define endl "\n"

ll powll(ll x , ll n){
    ll res = 1 ;
    while(n > 0){
        if(n & 1) res *= x ;
        x *= x ;
        n >>= 1 ;
    }
    return res ;
}

int n ;
ll A[101] ;

int main(){
    cin >> n ;
    rep(i,n) cin >> A[i] ;
    sort(A,A+n) ;
    ll res = 0 ;
    rep(t,300){
        vector<vector<ll>> dp(n+1,vector<ll>(301,0)) ;
        dp[0][0] = 1 ;
        rep(i,n){
            rep(j,301){
                dp[i+1][j] += dp[i][j] ;
                if(t >= A[i] && j+t-A[i] < 301) dp[i+1][j+t-A[i]] += dp[i][j] ;
            }
        }
        res += dp[n][t] ;
        ll sum = upper_bound(A,A+n,0) - lower_bound(A,A+n,0) ;
        res -= sum ;
    }
    cout << res - 1 << endl ;
}
0