| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 199928 | quocnguyen1012 | Bootfall (IZhO17_bootfall) | C++14 | 553 ms | 3448 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
using namespace std;
typedef long long ll;
const int maxn = 505, mod = 1e9 + 7;
int N, a[maxn];
int f[maxn * maxn];
vector<int> ret;
signed main(void)
{
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
if (fopen("A.INP", "r")){
freopen("A.INP", "r", stdin);
freopen("A.OUT", "w", stdout);
}
cin >> N;
int sum = 0;
f[0] = 1;
for (int i = 1; i <= N; ++i){
cin >> a[i];
sum += a[i];
for (int j = sum; j >= a[i]; --j){
f[j] += f[j - a[i]];
f[j] %= mod;
}
}
if (sum & 1 || f[sum / 2] == 0){
cout << "0";
return 0;
}
for (int i = 1; i < maxn * maxn; ++i){
ret.pb(i);
}
for (int i = 1; i <= N; ++i){
for (int j = a[i]; j <= sum; ++j){
f[j] -= f[j - a[i]];
if (f[j] < 0) f[j] += mod;
}
vector<int> vi;
for (auto & all : ret){
int val = sum - a[i] + all;
if (val < 0 || val % 2 == 1 || f[val / 2] == 0){
continue;
}
vi.pb(all);
}
swap(vi, ret);
for (int j = sum; j >= a[i]; --j){
f[j] += f[j - a[i]];
f[j] %= mod;
}
}
cout << ret.size() << '\n';
for (auto & it : ret) cout << it << ' ' ;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | 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... | ||||
