結果
| 問題 |
No.1825 Except One
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-01-30 20:22:00 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 9 ms / 3,000 ms |
| コード長 | 1,124 bytes |
| コンパイル時間 | 1,648 ms |
| コンパイル使用メモリ | 173,844 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-11 08:26:01 |
| 合計ジャッジ時間 | 2,821 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 31 |
ソースコード
#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 ;
}