# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
36181 | ToMoClone | Bootfall (IZhO17_bootfall) | C++14 | 679 ms | 6976 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/*input
4
1 3 1 5
*/
#include <stdio.h>
#include <vector>
using namespace std;
const int N = 501;
int check[N * N], cnt[250001], num[1000001], a[N], n, sum, ans;
int main(){
scanf("%d", &n);
check[0] = 1;
for(int i = 1; i <= n; ++i){
scanf("%d", &a[i]), sum += a[i];
for(int j = sum; j >= a[i]; --j)
check[j] += check[j - a[i]];
}
if((sum & 1) || check[sum >> 1] == 0) return puts("0"), 0;
for(int i = 1; i <= n; ++i){
for(int j = 0; j <= sum - a[i]; ++j)
check[j + a[i]] -= check[j];
for(int j = 1; j <= sum; ++j){
int Sum = sum + j - a[i];
if((Sum & 1) || ((Sum >> 1) < j)) continue;
if(check[Sum >> 1] != 0 && check[(Sum >> 1) - j] != 0) ++num[j];
ans += (num[j] == n);
}
for(int j = sum; j >= a[i]; --j)
check[j] += check[j - a[i]];
}
printf("%d\n", ans);
if(ans != 0){
for(int i = 1; i <= sum; ++i)
if(num[i] == n) printf("%d ", i);
puts("");
}
}
컴파일 시 표준 에러 (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... |