# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
167370 | 2019-12-07T18:17:08 Z | GioChkhaidze | Bootfall (IZhO17_bootfall) | C++14 | 705 ms | 2772 KB |
#include <bits/stdc++.h> #define ll long long using namespace std; const int N=505; int n,S,a[N],dp[N*N],mod=1e9+7; vector < int > ans; bitset < N*N > A,C; main () { cin>>n; for (int i=1; i<=n; i++) { cin>>a[i]; S+=a[i]; } sort(a+1,a+n+1); dp[0]=1; for (int i=1; i<=n; i++) for (int j=S; j>=a[i]; j--) { dp[j]+=dp[j-a[i]]; if (dp[j]>mod) dp[j]-=mod; } if (S%2 || !dp[S/2]) { cout<<0<<endl; return 0; } for (int i=1; i<=S; i++) C[i]=1; for (int i=1; i<=n; i++) { for (int j=a[i]; j<=S; j++) { dp[j]-=dp[j-a[i]]; if (dp[j]<0) dp[j]+=mod; } S-=a[i]; for (int j=1; j<=S; j++) { if (S<j) continue; if (!dp[j] && !dp[S-j]) continue; A[abs(S-j-j)]=1; } S+=a[i]; C=A&C,A=0; for (int j=S; j>=a[i]; j--) { dp[j]+=dp[j-a[i]]; if (dp[j]>mod) dp[j]-=mod; } } for (int i=1; i<=S; i++) if (C[i]) ans.push_back(i); printf("%d\n",ans.size()); for (int i=0; i<ans.size(); i++) printf("%d ",ans[i]); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 380 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 504 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 504 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 380 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 504 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 504 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 4 ms | 376 KB | Output is correct |
11 | Correct | 11 ms | 376 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 3 ms | 504 KB | Output is correct |
14 | Correct | 3 ms | 376 KB | Output is correct |
15 | Correct | 3 ms | 376 KB | Output is correct |
16 | Correct | 1 ms | 376 KB | Output is correct |
17 | Correct | 2 ms | 376 KB | Output is correct |
18 | Correct | 3 ms | 376 KB | Output is correct |
19 | Correct | 3 ms | 376 KB | Output is correct |
20 | Correct | 3 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 380 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 504 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 504 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 4 ms | 376 KB | Output is correct |
11 | Correct | 11 ms | 376 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 3 ms | 504 KB | Output is correct |
14 | Correct | 3 ms | 376 KB | Output is correct |
15 | Correct | 3 ms | 376 KB | Output is correct |
16 | Correct | 1 ms | 376 KB | Output is correct |
17 | Correct | 2 ms | 376 KB | Output is correct |
18 | Correct | 3 ms | 376 KB | Output is correct |
19 | Correct | 3 ms | 376 KB | Output is correct |
20 | Correct | 3 ms | 376 KB | Output is correct |
21 | Correct | 4 ms | 504 KB | Output is correct |
22 | Correct | 5 ms | 504 KB | Output is correct |
23 | Correct | 3 ms | 376 KB | Output is correct |
24 | Correct | 6 ms | 504 KB | Output is correct |
25 | Correct | 8 ms | 504 KB | Output is correct |
26 | Correct | 9 ms | 504 KB | Output is correct |
27 | Correct | 8 ms | 504 KB | Output is correct |
28 | Correct | 8 ms | 504 KB | Output is correct |
29 | Correct | 8 ms | 504 KB | Output is correct |
30 | Correct | 6 ms | 504 KB | Output is correct |
31 | Correct | 9 ms | 504 KB | Output is correct |
32 | Correct | 6 ms | 504 KB | Output is correct |
33 | Correct | 8 ms | 504 KB | Output is correct |
34 | Correct | 8 ms | 504 KB | Output is correct |
35 | Correct | 9 ms | 504 KB | Output is correct |
36 | Correct | 6 ms | 508 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 380 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 504 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 504 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 4 ms | 376 KB | Output is correct |
11 | Correct | 11 ms | 376 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 3 ms | 504 KB | Output is correct |
14 | Correct | 3 ms | 376 KB | Output is correct |
15 | Correct | 3 ms | 376 KB | Output is correct |
16 | Correct | 1 ms | 376 KB | Output is correct |
17 | Correct | 2 ms | 376 KB | Output is correct |
18 | Correct | 3 ms | 376 KB | Output is correct |
19 | Correct | 3 ms | 376 KB | Output is correct |
20 | Correct | 3 ms | 376 KB | Output is correct |
21 | Correct | 4 ms | 504 KB | Output is correct |
22 | Correct | 5 ms | 504 KB | Output is correct |
23 | Correct | 3 ms | 376 KB | Output is correct |
24 | Correct | 6 ms | 504 KB | Output is correct |
25 | Correct | 8 ms | 504 KB | Output is correct |
26 | Correct | 9 ms | 504 KB | Output is correct |
27 | Correct | 8 ms | 504 KB | Output is correct |
28 | Correct | 8 ms | 504 KB | Output is correct |
29 | Correct | 8 ms | 504 KB | Output is correct |
30 | Correct | 6 ms | 504 KB | Output is correct |
31 | Correct | 9 ms | 504 KB | Output is correct |
32 | Correct | 6 ms | 504 KB | Output is correct |
33 | Correct | 8 ms | 504 KB | Output is correct |
34 | Correct | 8 ms | 504 KB | Output is correct |
35 | Correct | 9 ms | 504 KB | Output is correct |
36 | Correct | 6 ms | 508 KB | Output is correct |
37 | Correct | 28 ms | 628 KB | Output is correct |
38 | Correct | 28 ms | 632 KB | Output is correct |
39 | Correct | 72 ms | 696 KB | Output is correct |
40 | Correct | 138 ms | 760 KB | Output is correct |
41 | Correct | 96 ms | 760 KB | Output is correct |
42 | Correct | 51 ms | 760 KB | Output is correct |
43 | Correct | 85 ms | 1016 KB | Output is correct |
44 | Correct | 92 ms | 1064 KB | Output is correct |
45 | Correct | 124 ms | 1144 KB | Output is correct |
46 | Correct | 47 ms | 504 KB | Output is correct |
47 | Correct | 55 ms | 760 KB | Output is correct |
48 | Correct | 92 ms | 1016 KB | Output is correct |
49 | Correct | 83 ms | 760 KB | Output is correct |
50 | Correct | 55 ms | 764 KB | Output is correct |
51 | Correct | 11 ms | 504 KB | Output is correct |
52 | Correct | 116 ms | 1124 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 380 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 504 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 504 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 4 ms | 376 KB | Output is correct |
11 | Correct | 11 ms | 376 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 3 ms | 504 KB | Output is correct |
14 | Correct | 3 ms | 376 KB | Output is correct |
15 | Correct | 3 ms | 376 KB | Output is correct |
16 | Correct | 1 ms | 376 KB | Output is correct |
17 | Correct | 2 ms | 376 KB | Output is correct |
18 | Correct | 3 ms | 376 KB | Output is correct |
19 | Correct | 3 ms | 376 KB | Output is correct |
20 | Correct | 3 ms | 376 KB | Output is correct |
21 | Correct | 4 ms | 504 KB | Output is correct |
22 | Correct | 5 ms | 504 KB | Output is correct |
23 | Correct | 3 ms | 376 KB | Output is correct |
24 | Correct | 6 ms | 504 KB | Output is correct |
25 | Correct | 8 ms | 504 KB | Output is correct |
26 | Correct | 9 ms | 504 KB | Output is correct |
27 | Correct | 8 ms | 504 KB | Output is correct |
28 | Correct | 8 ms | 504 KB | Output is correct |
29 | Correct | 8 ms | 504 KB | Output is correct |
30 | Correct | 6 ms | 504 KB | Output is correct |
31 | Correct | 9 ms | 504 KB | Output is correct |
32 | Correct | 6 ms | 504 KB | Output is correct |
33 | Correct | 8 ms | 504 KB | Output is correct |
34 | Correct | 8 ms | 504 KB | Output is correct |
35 | Correct | 9 ms | 504 KB | Output is correct |
36 | Correct | 6 ms | 508 KB | Output is correct |
37 | Correct | 28 ms | 628 KB | Output is correct |
38 | Correct | 28 ms | 632 KB | Output is correct |
39 | Correct | 72 ms | 696 KB | Output is correct |
40 | Correct | 138 ms | 760 KB | Output is correct |
41 | Correct | 96 ms | 760 KB | Output is correct |
42 | Correct | 51 ms | 760 KB | Output is correct |
43 | Correct | 85 ms | 1016 KB | Output is correct |
44 | Correct | 92 ms | 1064 KB | Output is correct |
45 | Correct | 124 ms | 1144 KB | Output is correct |
46 | Correct | 47 ms | 504 KB | Output is correct |
47 | Correct | 55 ms | 760 KB | Output is correct |
48 | Correct | 92 ms | 1016 KB | Output is correct |
49 | Correct | 83 ms | 760 KB | Output is correct |
50 | Correct | 55 ms | 764 KB | Output is correct |
51 | Correct | 11 ms | 504 KB | Output is correct |
52 | Correct | 116 ms | 1124 KB | Output is correct |
53 | Correct | 91 ms | 888 KB | Output is correct |
54 | Correct | 123 ms | 988 KB | Output is correct |
55 | Correct | 235 ms | 1532 KB | Output is correct |
56 | Correct | 107 ms | 1148 KB | Output is correct |
57 | Correct | 246 ms | 1652 KB | Output is correct |
58 | Correct | 133 ms | 1016 KB | Output is correct |
59 | Correct | 170 ms | 1268 KB | Output is correct |
60 | Correct | 28 ms | 636 KB | Output is correct |
61 | Correct | 182 ms | 1268 KB | Output is correct |
62 | Correct | 188 ms | 1396 KB | Output is correct |
63 | Correct | 201 ms | 1608 KB | Output is correct |
64 | Correct | 195 ms | 1556 KB | Output is correct |
65 | Correct | 85 ms | 632 KB | Output is correct |
66 | Correct | 87 ms | 708 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 380 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 504 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 504 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 4 ms | 376 KB | Output is correct |
11 | Correct | 11 ms | 376 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 3 ms | 504 KB | Output is correct |
14 | Correct | 3 ms | 376 KB | Output is correct |
15 | Correct | 3 ms | 376 KB | Output is correct |
16 | Correct | 1 ms | 376 KB | Output is correct |
17 | Correct | 2 ms | 376 KB | Output is correct |
18 | Correct | 3 ms | 376 KB | Output is correct |
19 | Correct | 3 ms | 376 KB | Output is correct |
20 | Correct | 3 ms | 376 KB | Output is correct |
21 | Correct | 4 ms | 504 KB | Output is correct |
22 | Correct | 5 ms | 504 KB | Output is correct |
23 | Correct | 3 ms | 376 KB | Output is correct |
24 | Correct | 6 ms | 504 KB | Output is correct |
25 | Correct | 8 ms | 504 KB | Output is correct |
26 | Correct | 9 ms | 504 KB | Output is correct |
27 | Correct | 8 ms | 504 KB | Output is correct |
28 | Correct | 8 ms | 504 KB | Output is correct |
29 | Correct | 8 ms | 504 KB | Output is correct |
30 | Correct | 6 ms | 504 KB | Output is correct |
31 | Correct | 9 ms | 504 KB | Output is correct |
32 | Correct | 6 ms | 504 KB | Output is correct |
33 | Correct | 8 ms | 504 KB | Output is correct |
34 | Correct | 8 ms | 504 KB | Output is correct |
35 | Correct | 9 ms | 504 KB | Output is correct |
36 | Correct | 6 ms | 508 KB | Output is correct |
37 | Correct | 28 ms | 628 KB | Output is correct |
38 | Correct | 28 ms | 632 KB | Output is correct |
39 | Correct | 72 ms | 696 KB | Output is correct |
40 | Correct | 138 ms | 760 KB | Output is correct |
41 | Correct | 96 ms | 760 KB | Output is correct |
42 | Correct | 51 ms | 760 KB | Output is correct |
43 | Correct | 85 ms | 1016 KB | Output is correct |
44 | Correct | 92 ms | 1064 KB | Output is correct |
45 | Correct | 124 ms | 1144 KB | Output is correct |
46 | Correct | 47 ms | 504 KB | Output is correct |
47 | Correct | 55 ms | 760 KB | Output is correct |
48 | Correct | 92 ms | 1016 KB | Output is correct |
49 | Correct | 83 ms | 760 KB | Output is correct |
50 | Correct | 55 ms | 764 KB | Output is correct |
51 | Correct | 11 ms | 504 KB | Output is correct |
52 | Correct | 116 ms | 1124 KB | Output is correct |
53 | Correct | 91 ms | 888 KB | Output is correct |
54 | Correct | 123 ms | 988 KB | Output is correct |
55 | Correct | 235 ms | 1532 KB | Output is correct |
56 | Correct | 107 ms | 1148 KB | Output is correct |
57 | Correct | 246 ms | 1652 KB | Output is correct |
58 | Correct | 133 ms | 1016 KB | Output is correct |
59 | Correct | 170 ms | 1268 KB | Output is correct |
60 | Correct | 28 ms | 636 KB | Output is correct |
61 | Correct | 182 ms | 1268 KB | Output is correct |
62 | Correct | 188 ms | 1396 KB | Output is correct |
63 | Correct | 201 ms | 1608 KB | Output is correct |
64 | Correct | 195 ms | 1556 KB | Output is correct |
65 | Correct | 85 ms | 632 KB | Output is correct |
66 | Correct | 87 ms | 708 KB | Output is correct |
67 | Correct | 208 ms | 1268 KB | Output is correct |
68 | Correct | 71 ms | 760 KB | Output is correct |
69 | Correct | 633 ms | 2416 KB | Output is correct |
70 | Correct | 387 ms | 1780 KB | Output is correct |
71 | Correct | 373 ms | 1732 KB | Output is correct |
72 | Correct | 372 ms | 892 KB | Output is correct |
73 | Correct | 371 ms | 1016 KB | Output is correct |
74 | Correct | 671 ms | 2640 KB | Output is correct |
75 | Correct | 517 ms | 2160 KB | Output is correct |
76 | Correct | 705 ms | 2564 KB | Output is correct |
77 | Correct | 699 ms | 2772 KB | Output is correct |