| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1281974 | Hurryup_7735 | Bootfall (IZhO17_bootfall) | C++20 | 0 ms | 0 KiB |
//In The Name Of ALLAH!
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define ld long double
#define endl '\n'
#define pb push_back
#define pf push_front
#define Zemur007 ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define bpc __builtin_popcountll
#define btz __builtin_ctzll
#define all(x) x.begin() , x.end()
#define allr(x) x.rbegin() , x.rend()
#define F first
#define S second
#define pll pair<ll , ll>
#define turtle tuple<ll , ll , ll>
#define pss pair<string , string>
#define YES cout << "YES" << endl;
#define NO cout << "NO" << endl;
#define indexed_set tree<pll , null_type , less<pll> , rb_tree_tag , tree_order_statistics_node_update>
const ll sz = 3e5 + 5 , INF = 1e18 , MOD = 1e9 + 7;
ll a[sz];
bool dp[sz];
ll mask , i , j , k , l;
void solve(){
unordered_map<ll , ll> dp;
ll n , sum = 0 , con = 0; cin >> n;
for(i = 1 ; i <= n ; i++) cin >> a[i] , sum += a[i];
sort(a + 1 , a + n + 1);
for(i = n ; i > 1 ; i--) con += a[i];
for(i = 0 ; i <= sum ; i++) dp[i] = false;
dp[0] = true;
for(i = 1 ; i <= n ; i++){
for(j = sum ; j >= 0 ; j--){
if(j - a[i] >= 0) dp[j] |= dp[j - a[i]];
}
}
if(!dp[sum / 2]) cout << 0 << endl;
vector<ll> ans;
for(i = 1 ; i <= con ; i++){
ll cnt = 0;
for(j = 0 ; j <= sum ; j++){
if(!dp[j]) continue;
if(){
ok = false;
break;
}
}
if(ok) ans.pb(i);
}
cout << ans.size() << endl;
for(ll i : ans) cout << i << ' ';
cout << endl;
}
signed main(){
Zemur007;
//open;
ll t = 1;
// cin >> t;
while(t--){
solve();
}
// for(ll testcase = 1 ; testcase <= t ; testcase++){
// cout << "Case " << testcase << ":" << endl;
// solve();
// }
}
