제출 #1128083

#제출 시각아이디문제언어결과실행 시간메모리
1128083azikBootfall (IZhO17_bootfall)C++20
0 / 100
1 ms328 KiB
#include <bits/stdc++.h> #define pb push_back #define all(v) v.begin() , v.end() using namespace std; int n , m ; const int N = 521; signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cin>>n ; int sum =0 ; vector<int>a; for(int i= 1 ; i <= n; i++){ int h;cin>>h; sum+=h; a.pb(h); } vector<int>ans; for(int x = 1 ; x <= sum* 5 ; x++) { a.pb(x); int ok =0 ; for(int pos = 0 ; pos < n ;pos++) { int sum2 = 0; vector<int> dp(sum*5, 0); dp[0] = 1; for (int i = 0; i < a.size(); i++) { if (i == pos)continue; sum2 += a[i]; } //cout << a[pos] << ' ' << x << ' ' << sum2 << '\n'; if (sum2 % 2 != 0) { ok = 1; break; } sum2 /= 2; for (int i = 0; i < a.size(); i++) { if (i == pos)continue; for (int j = sum2; j >= a[i]; j--) { if (dp[j - a[i]] == 1)dp[j] = 1; } } if (!dp[sum2]) { ok = 1; break; } } if(!ok){ ans.pb(x); } a.pop_back(); } cout<< ans.size() << '\n'; for(auto it:ans){ cout << it << ' '; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...