| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 92828 | SamAnd | Bootfall (IZhO17_bootfall) | C++17 | 620 ms | 124876 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int N = 502;
int n;
int a[N];
int m;
int u[N * N];
int uu[N * N];
bool t[N][N * N];
int main()
{
//freopen("input2.txt", "r", stdin);
cin >> n;
for (int i = 1; i <= n; ++i)
{
cin >> a[i];
m += a[i];
}
u[0] = 1;
for (int i = 1; i <= n; ++i)
{
for (int j = m; j >= 0; --j)
{
if (j + a[i] <= m)
u[j + a[i]] += u[j];
}
}
for (int i = 1; i <= n; ++i)
{
memcpy(uu, u, sizeof u);
for (int j = 0; j <= m; ++j)
{
if (j + a[i] <= m)
uu[j + a[i]] -= uu[j];
}
for (int j = 0; j <= m; ++j)
{
if (uu[j])
t[i][j] = true;
}
}
if ((m % 2) == 1 || !u[m / 2])
{
cout << 0 << endl;
return 0;
}
vector<int> ans;
for (int x = 1; x <= m; ++x)
{
bool z = true;
for (int i = 1; i <= n; ++i)
{
int y = (m - a[i] + x) / 2;
if (!((m - a[i] + x) % 2 == 0 && y <= m && t[i][y]))
{
z = false;
break;
}
}
if (z)
ans.push_back(x);
}
cout << ans.size() << endl;
for (int i = 0; i < ans.size(); ++i)
cout << ans[i] << ' ';
cout << endl;
return 0;
}
컴파일 시 표준 에러 (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... | ||||
