# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
163782 |
2019-11-15T09:29:33 Z |
MvC |
Bootfall (IZhO17_bootfall) |
C++11 |
|
1000 ms |
9100 KB |
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
#include <bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define mkp make_pair
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
typedef long long ll;
typedef long double ld;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<62);
const int inf=(1<<30);
const int nmax=5e2+5;
const int mmax=500*500;
const int mod=1e9+7;
using namespace std;
int n,a[nmax],i,j,sm;
vector<int>vc;
bitset<mmax>f[nmax];
int main()
{
//freopen("sol.in","r",stdin);
//freopen("sol.out","w",stdout);
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
cin>>n;
for(i=1;i<=n;i++)cin>>a[i],sm+=a[i];
if(sm&1)rc(0);
for(i=0;i<=n;i++)
{
f[i][0]=1;
for(j=1;j<=n;j++)
{
if(i==j)continue;
f[i]|=(f[i]<<a[j]);
}
if(!f[0][sm/2])rc(0);
}
for(i=1;i<=sm;i++)
{
for(j=1;j<=n;j++)
{
if((sm-a[j]+i)&1 || !f[j][(sm-a[j]+i)/2])break;
}
if(j==n+1)vc.pb(i);
}
cout<<(int)vc.size()<<endl;
for(i=0;i<(int)vc.size();i++)cout<<vc[i]<<" ";
cout<<endl;
return 0;
}
Compilation message
bootfall.cpp:2:0: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
#pragma GCC optimization("O3")
bootfall.cpp:3:0: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
#pragma GCC optimization("unroll-loops")
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
504 KB |
Output is correct |
2 |
Correct |
3 ms |
632 KB |
Output is correct |
3 |
Correct |
2 ms |
504 KB |
Output is correct |
4 |
Correct |
3 ms |
504 KB |
Output is correct |
5 |
Correct |
4 ms |
760 KB |
Output is correct |
6 |
Correct |
3 ms |
632 KB |
Output is correct |
7 |
Correct |
3 ms |
632 KB |
Output is correct |
8 |
Correct |
5 ms |
888 KB |
Output is correct |
9 |
Correct |
4 ms |
760 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
504 KB |
Output is correct |
2 |
Correct |
3 ms |
632 KB |
Output is correct |
3 |
Correct |
2 ms |
504 KB |
Output is correct |
4 |
Correct |
3 ms |
504 KB |
Output is correct |
5 |
Correct |
4 ms |
760 KB |
Output is correct |
6 |
Correct |
3 ms |
632 KB |
Output is correct |
7 |
Correct |
3 ms |
632 KB |
Output is correct |
8 |
Correct |
5 ms |
888 KB |
Output is correct |
9 |
Correct |
4 ms |
760 KB |
Output is correct |
10 |
Correct |
15 ms |
1272 KB |
Output is correct |
11 |
Correct |
15 ms |
1272 KB |
Output is correct |
12 |
Correct |
16 ms |
1348 KB |
Output is correct |
13 |
Correct |
13 ms |
1272 KB |
Output is correct |
14 |
Correct |
16 ms |
1272 KB |
Output is correct |
15 |
Correct |
15 ms |
1272 KB |
Output is correct |
16 |
Correct |
16 ms |
1272 KB |
Output is correct |
17 |
Correct |
7 ms |
1016 KB |
Output is correct |
18 |
Correct |
11 ms |
1144 KB |
Output is correct |
19 |
Correct |
12 ms |
1148 KB |
Output is correct |
20 |
Correct |
16 ms |
1408 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
504 KB |
Output is correct |
2 |
Correct |
3 ms |
632 KB |
Output is correct |
3 |
Correct |
2 ms |
504 KB |
Output is correct |
4 |
Correct |
3 ms |
504 KB |
Output is correct |
5 |
Correct |
4 ms |
760 KB |
Output is correct |
6 |
Correct |
3 ms |
632 KB |
Output is correct |
7 |
Correct |
3 ms |
632 KB |
Output is correct |
8 |
Correct |
5 ms |
888 KB |
Output is correct |
9 |
Correct |
4 ms |
760 KB |
Output is correct |
10 |
Correct |
15 ms |
1272 KB |
Output is correct |
11 |
Correct |
15 ms |
1272 KB |
Output is correct |
12 |
Correct |
16 ms |
1348 KB |
Output is correct |
13 |
Correct |
13 ms |
1272 KB |
Output is correct |
14 |
Correct |
16 ms |
1272 KB |
Output is correct |
15 |
Correct |
15 ms |
1272 KB |
Output is correct |
16 |
Correct |
16 ms |
1272 KB |
Output is correct |
17 |
Correct |
7 ms |
1016 KB |
Output is correct |
18 |
Correct |
11 ms |
1144 KB |
Output is correct |
19 |
Correct |
12 ms |
1148 KB |
Output is correct |
20 |
Correct |
16 ms |
1408 KB |
Output is correct |
21 |
Correct |
61 ms |
2472 KB |
Output is correct |
22 |
Correct |
85 ms |
2808 KB |
Output is correct |
23 |
Correct |
38 ms |
2040 KB |
Output is correct |
24 |
Correct |
126 ms |
3320 KB |
Output is correct |
25 |
Correct |
126 ms |
3368 KB |
Output is correct |
26 |
Correct |
153 ms |
3588 KB |
Output is correct |
27 |
Correct |
139 ms |
3524 KB |
Output is correct |
28 |
Correct |
141 ms |
3480 KB |
Output is correct |
29 |
Correct |
140 ms |
3544 KB |
Output is correct |
30 |
Correct |
137 ms |
3488 KB |
Output is correct |
31 |
Correct |
141 ms |
3588 KB |
Output is correct |
32 |
Correct |
141 ms |
3576 KB |
Output is correct |
33 |
Correct |
142 ms |
3420 KB |
Output is correct |
34 |
Correct |
142 ms |
3576 KB |
Output is correct |
35 |
Correct |
140 ms |
3436 KB |
Output is correct |
36 |
Correct |
141 ms |
3448 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
504 KB |
Output is correct |
2 |
Correct |
3 ms |
632 KB |
Output is correct |
3 |
Correct |
2 ms |
504 KB |
Output is correct |
4 |
Correct |
3 ms |
504 KB |
Output is correct |
5 |
Correct |
4 ms |
760 KB |
Output is correct |
6 |
Correct |
3 ms |
632 KB |
Output is correct |
7 |
Correct |
3 ms |
632 KB |
Output is correct |
8 |
Correct |
5 ms |
888 KB |
Output is correct |
9 |
Correct |
4 ms |
760 KB |
Output is correct |
10 |
Correct |
15 ms |
1272 KB |
Output is correct |
11 |
Correct |
15 ms |
1272 KB |
Output is correct |
12 |
Correct |
16 ms |
1348 KB |
Output is correct |
13 |
Correct |
13 ms |
1272 KB |
Output is correct |
14 |
Correct |
16 ms |
1272 KB |
Output is correct |
15 |
Correct |
15 ms |
1272 KB |
Output is correct |
16 |
Correct |
16 ms |
1272 KB |
Output is correct |
17 |
Correct |
7 ms |
1016 KB |
Output is correct |
18 |
Correct |
11 ms |
1144 KB |
Output is correct |
19 |
Correct |
12 ms |
1148 KB |
Output is correct |
20 |
Correct |
16 ms |
1408 KB |
Output is correct |
21 |
Correct |
61 ms |
2472 KB |
Output is correct |
22 |
Correct |
85 ms |
2808 KB |
Output is correct |
23 |
Correct |
38 ms |
2040 KB |
Output is correct |
24 |
Correct |
126 ms |
3320 KB |
Output is correct |
25 |
Correct |
126 ms |
3368 KB |
Output is correct |
26 |
Correct |
153 ms |
3588 KB |
Output is correct |
27 |
Correct |
139 ms |
3524 KB |
Output is correct |
28 |
Correct |
141 ms |
3480 KB |
Output is correct |
29 |
Correct |
140 ms |
3544 KB |
Output is correct |
30 |
Correct |
137 ms |
3488 KB |
Output is correct |
31 |
Correct |
141 ms |
3588 KB |
Output is correct |
32 |
Correct |
141 ms |
3576 KB |
Output is correct |
33 |
Correct |
142 ms |
3420 KB |
Output is correct |
34 |
Correct |
142 ms |
3576 KB |
Output is correct |
35 |
Correct |
140 ms |
3436 KB |
Output is correct |
36 |
Correct |
141 ms |
3448 KB |
Output is correct |
37 |
Correct |
572 ms |
6716 KB |
Output is correct |
38 |
Correct |
553 ms |
6744 KB |
Output is correct |
39 |
Correct |
887 ms |
8060 KB |
Output is correct |
40 |
Correct |
992 ms |
9100 KB |
Output is correct |
41 |
Correct |
984 ms |
8704 KB |
Output is correct |
42 |
Correct |
872 ms |
8268 KB |
Output is correct |
43 |
Correct |
833 ms |
8464 KB |
Output is correct |
44 |
Correct |
886 ms |
8568 KB |
Output is correct |
45 |
Correct |
881 ms |
8604 KB |
Output is correct |
46 |
Execution timed out |
1048 ms |
8748 KB |
Time limit exceeded |
47 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
504 KB |
Output is correct |
2 |
Correct |
3 ms |
632 KB |
Output is correct |
3 |
Correct |
2 ms |
504 KB |
Output is correct |
4 |
Correct |
3 ms |
504 KB |
Output is correct |
5 |
Correct |
4 ms |
760 KB |
Output is correct |
6 |
Correct |
3 ms |
632 KB |
Output is correct |
7 |
Correct |
3 ms |
632 KB |
Output is correct |
8 |
Correct |
5 ms |
888 KB |
Output is correct |
9 |
Correct |
4 ms |
760 KB |
Output is correct |
10 |
Correct |
15 ms |
1272 KB |
Output is correct |
11 |
Correct |
15 ms |
1272 KB |
Output is correct |
12 |
Correct |
16 ms |
1348 KB |
Output is correct |
13 |
Correct |
13 ms |
1272 KB |
Output is correct |
14 |
Correct |
16 ms |
1272 KB |
Output is correct |
15 |
Correct |
15 ms |
1272 KB |
Output is correct |
16 |
Correct |
16 ms |
1272 KB |
Output is correct |
17 |
Correct |
7 ms |
1016 KB |
Output is correct |
18 |
Correct |
11 ms |
1144 KB |
Output is correct |
19 |
Correct |
12 ms |
1148 KB |
Output is correct |
20 |
Correct |
16 ms |
1408 KB |
Output is correct |
21 |
Correct |
61 ms |
2472 KB |
Output is correct |
22 |
Correct |
85 ms |
2808 KB |
Output is correct |
23 |
Correct |
38 ms |
2040 KB |
Output is correct |
24 |
Correct |
126 ms |
3320 KB |
Output is correct |
25 |
Correct |
126 ms |
3368 KB |
Output is correct |
26 |
Correct |
153 ms |
3588 KB |
Output is correct |
27 |
Correct |
139 ms |
3524 KB |
Output is correct |
28 |
Correct |
141 ms |
3480 KB |
Output is correct |
29 |
Correct |
140 ms |
3544 KB |
Output is correct |
30 |
Correct |
137 ms |
3488 KB |
Output is correct |
31 |
Correct |
141 ms |
3588 KB |
Output is correct |
32 |
Correct |
141 ms |
3576 KB |
Output is correct |
33 |
Correct |
142 ms |
3420 KB |
Output is correct |
34 |
Correct |
142 ms |
3576 KB |
Output is correct |
35 |
Correct |
140 ms |
3436 KB |
Output is correct |
36 |
Correct |
141 ms |
3448 KB |
Output is correct |
37 |
Correct |
572 ms |
6716 KB |
Output is correct |
38 |
Correct |
553 ms |
6744 KB |
Output is correct |
39 |
Correct |
887 ms |
8060 KB |
Output is correct |
40 |
Correct |
992 ms |
9100 KB |
Output is correct |
41 |
Correct |
984 ms |
8704 KB |
Output is correct |
42 |
Correct |
872 ms |
8268 KB |
Output is correct |
43 |
Correct |
833 ms |
8464 KB |
Output is correct |
44 |
Correct |
886 ms |
8568 KB |
Output is correct |
45 |
Correct |
881 ms |
8604 KB |
Output is correct |
46 |
Execution timed out |
1048 ms |
8748 KB |
Time limit exceeded |
47 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
504 KB |
Output is correct |
2 |
Correct |
3 ms |
632 KB |
Output is correct |
3 |
Correct |
2 ms |
504 KB |
Output is correct |
4 |
Correct |
3 ms |
504 KB |
Output is correct |
5 |
Correct |
4 ms |
760 KB |
Output is correct |
6 |
Correct |
3 ms |
632 KB |
Output is correct |
7 |
Correct |
3 ms |
632 KB |
Output is correct |
8 |
Correct |
5 ms |
888 KB |
Output is correct |
9 |
Correct |
4 ms |
760 KB |
Output is correct |
10 |
Correct |
15 ms |
1272 KB |
Output is correct |
11 |
Correct |
15 ms |
1272 KB |
Output is correct |
12 |
Correct |
16 ms |
1348 KB |
Output is correct |
13 |
Correct |
13 ms |
1272 KB |
Output is correct |
14 |
Correct |
16 ms |
1272 KB |
Output is correct |
15 |
Correct |
15 ms |
1272 KB |
Output is correct |
16 |
Correct |
16 ms |
1272 KB |
Output is correct |
17 |
Correct |
7 ms |
1016 KB |
Output is correct |
18 |
Correct |
11 ms |
1144 KB |
Output is correct |
19 |
Correct |
12 ms |
1148 KB |
Output is correct |
20 |
Correct |
16 ms |
1408 KB |
Output is correct |
21 |
Correct |
61 ms |
2472 KB |
Output is correct |
22 |
Correct |
85 ms |
2808 KB |
Output is correct |
23 |
Correct |
38 ms |
2040 KB |
Output is correct |
24 |
Correct |
126 ms |
3320 KB |
Output is correct |
25 |
Correct |
126 ms |
3368 KB |
Output is correct |
26 |
Correct |
153 ms |
3588 KB |
Output is correct |
27 |
Correct |
139 ms |
3524 KB |
Output is correct |
28 |
Correct |
141 ms |
3480 KB |
Output is correct |
29 |
Correct |
140 ms |
3544 KB |
Output is correct |
30 |
Correct |
137 ms |
3488 KB |
Output is correct |
31 |
Correct |
141 ms |
3588 KB |
Output is correct |
32 |
Correct |
141 ms |
3576 KB |
Output is correct |
33 |
Correct |
142 ms |
3420 KB |
Output is correct |
34 |
Correct |
142 ms |
3576 KB |
Output is correct |
35 |
Correct |
140 ms |
3436 KB |
Output is correct |
36 |
Correct |
141 ms |
3448 KB |
Output is correct |
37 |
Correct |
572 ms |
6716 KB |
Output is correct |
38 |
Correct |
553 ms |
6744 KB |
Output is correct |
39 |
Correct |
887 ms |
8060 KB |
Output is correct |
40 |
Correct |
992 ms |
9100 KB |
Output is correct |
41 |
Correct |
984 ms |
8704 KB |
Output is correct |
42 |
Correct |
872 ms |
8268 KB |
Output is correct |
43 |
Correct |
833 ms |
8464 KB |
Output is correct |
44 |
Correct |
886 ms |
8568 KB |
Output is correct |
45 |
Correct |
881 ms |
8604 KB |
Output is correct |
46 |
Execution timed out |
1048 ms |
8748 KB |
Time limit exceeded |
47 |
Halted |
0 ms |
0 KB |
- |