| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 766770 | Trunkty | Bootfall (IZhO17_bootfall) | C++14 | 1088 ms | 2532 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
int n,tot,mod=1e9+7;
int arr[505],dp[250005];
signed main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
cin >> n;
for(int i=1;i<=n;i++){
cin >> arr[i];
tot += arr[i];
}
dp[0] = 1;
for(int i=1;i<=n;i++){
for(int j=250000;j>=arr[i];j--){
dp[j] += dp[j-arr[i]];
dp[j] %= mod;
}
}
if(tot%2 or dp[tot/2]==0){
cout << 0 << "\n";
cout << "\n";
return 0;
}
vector<int> ans;
for(int i=1;i<=250000;i++){
bool yes = true;
for(int j=1;j<=n;j++){
if((tot-arr[j]+i)%2){
yes = false;
break;
}
int x = (tot-arr[j]+i)/2;
if(!dp[x]){
yes = false;
break;
}
int c1=0,c2=0;
for(int k=x;k>=0;k-=arr[j]){
c1 += dp[k];
swap(c1,c2);
}
if(c1%mod==c2%mod){
yes = false;
break;
}
}
if(yes){
ans.push_back(i);
}
}
cout << ans.size() << "\n";
for(int i:ans){
cout << i << " ";
}
cout << "\n";
return 0;
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
