| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 94409 | Kastanda | Bootfall (IZhO17_bootfall) | C++11 | 406 ms | 1960 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
const int N = 505, SQ = 24;
int n, sum, A[N];
bitset < N * N > T, R, B, P[SQ];
int main()
{
scanf("%d", &n);
bool odd = 0, even = 0;
for (int i = 0; i < n; i++)
{
scanf("%d", &A[i]);
sum += A[i];
if (A[i] & 1) odd = 1;
else even = 1;
}
if (odd && even)
return !printf("0");
if (odd && (n & 1))
return !printf("0");
for (int i = 0; i <= (n - 1) / SQ; i++)
{
P[i][0] = 1;
int l = i * SQ, r = min(l + SQ, n);
for (int j = 0; j < n; j++)
if (j < l || r <= j)
P[i] |= P[i] << A[j];
}
B[0] = 1;
for (int j = 0; j < n; j++)
B |= B << A[j];
if (!B[sum >> 1])
return !printf("0");
for (int j = 1; j < N * N; j++)
R[j] = 1;
for (int i = 0; i < n; i++)
{
int block = i / SQ;
int l = block * SQ, r = min(l + SQ, n);
B = P[block];
for (int j = l; j < r; j++)
if (j != i)
B |= B << A[j];
int _sum = sum - A[i];
int half = (_sum + 2) >> 1;
T = 0;
for (int j = half; j <= _sum; j++)
if (B[j]) T[j + j - _sum] = 1;
R = R & T;
}
printf("%d\n", (int)R.count());
for (int j = 1; j < N * N; j++)
if (R[j]) printf("%d ", j);
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... | ||||
