| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 675655 | LucaIlie | Bootfall (IZhO17_bootfall) | C++17 | 402 ms | 1948 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int maxN = 500;
const int maxS = maxN * maxN;
int v[maxN + 1], dp[maxS + 1];
bitset<maxS + 1> tim, timTemp;
int main() {
int n, s = 0;
cin >> n;
for ( int i = 1; i <= n; i++ )
cin >> v[i], s += v[i];
dp[0] = 1;
for ( int i = 1; i <= n; i++ ) {
for ( int j = s; j >= v[i]; j-- )
dp[j] += dp[j - v[i]];
}
if ( s % 2 != 0 || !dp[s / 2] ) {
cout << 0;
return 0;
}
for ( int i = 0; i <= s; i++ )
tim[i] = true;
for ( int r = 1; r <= n; r++ ) {
for ( int j = v[r]; j <= s; j++ )
dp[j] -= dp[j - v[r]];
timTemp.reset();
for ( int i = 0; i <= s; i++ ) {
if ( dp[i] )
timTemp[abs( s - v[r] - i - i )] = true;
}
tim &= timTemp;
for ( int j = s; j >= v[r]; j-- )
dp[j] += dp[j - v[r]];
}
tim[0] = false;
cout << tim.count() << "\n";
for ( int i = 0; i <= s; i++ ) {
if ( tim[i] )
cout << i << " ";
}
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... | ||||
