Submission #163779

# Submission time Handle Problem Language Result Execution time Memory
163779 2019-11-15T09:24:58 Z MvC Bootfall (IZhO17_bootfall) C++11
65 / 100
1000 ms 7056 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=350*350;
const int mod=1e9+7;
using namespace std;
int n,a[nmax],sm,i,j;
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 2 ms 376 KB Output is correct
2 Correct 2 ms 504 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 3 ms 504 KB Output is correct
6 Correct 3 ms 504 KB Output is correct
7 Correct 2 ms 504 KB Output is correct
8 Correct 3 ms 504 KB Output is correct
9 Correct 3 ms 504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 504 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 3 ms 504 KB Output is correct
6 Correct 3 ms 504 KB Output is correct
7 Correct 2 ms 504 KB Output is correct
8 Correct 3 ms 504 KB Output is correct
9 Correct 3 ms 504 KB Output is correct
10 Correct 8 ms 888 KB Output is correct
11 Correct 9 ms 888 KB Output is correct
12 Correct 8 ms 888 KB Output is correct
13 Correct 7 ms 764 KB Output is correct
14 Correct 7 ms 888 KB Output is correct
15 Correct 7 ms 888 KB Output is correct
16 Correct 8 ms 892 KB Output is correct
17 Correct 4 ms 632 KB Output is correct
18 Correct 6 ms 760 KB Output is correct
19 Correct 7 ms 760 KB Output is correct
20 Correct 8 ms 888 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 504 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 3 ms 504 KB Output is correct
6 Correct 3 ms 504 KB Output is correct
7 Correct 2 ms 504 KB Output is correct
8 Correct 3 ms 504 KB Output is correct
9 Correct 3 ms 504 KB Output is correct
10 Correct 8 ms 888 KB Output is correct
11 Correct 9 ms 888 KB Output is correct
12 Correct 8 ms 888 KB Output is correct
13 Correct 7 ms 764 KB Output is correct
14 Correct 7 ms 888 KB Output is correct
15 Correct 7 ms 888 KB Output is correct
16 Correct 8 ms 892 KB Output is correct
17 Correct 4 ms 632 KB Output is correct
18 Correct 6 ms 760 KB Output is correct
19 Correct 7 ms 760 KB Output is correct
20 Correct 8 ms 888 KB Output is correct
21 Correct 28 ms 1400 KB Output is correct
22 Correct 36 ms 1536 KB Output is correct
23 Correct 18 ms 1144 KB Output is correct
24 Correct 56 ms 1912 KB Output is correct
25 Correct 58 ms 1832 KB Output is correct
26 Correct 63 ms 1912 KB Output is correct
27 Correct 63 ms 1912 KB Output is correct
28 Correct 63 ms 1884 KB Output is correct
29 Correct 63 ms 1912 KB Output is correct
30 Correct 62 ms 2060 KB Output is correct
31 Correct 64 ms 1944 KB Output is correct
32 Correct 65 ms 1912 KB Output is correct
33 Correct 64 ms 1912 KB Output is correct
34 Correct 62 ms 2008 KB Output is correct
35 Correct 63 ms 1916 KB Output is correct
36 Correct 65 ms 1932 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 504 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 3 ms 504 KB Output is correct
6 Correct 3 ms 504 KB Output is correct
7 Correct 2 ms 504 KB Output is correct
8 Correct 3 ms 504 KB Output is correct
9 Correct 3 ms 504 KB Output is correct
10 Correct 8 ms 888 KB Output is correct
11 Correct 9 ms 888 KB Output is correct
12 Correct 8 ms 888 KB Output is correct
13 Correct 7 ms 764 KB Output is correct
14 Correct 7 ms 888 KB Output is correct
15 Correct 7 ms 888 KB Output is correct
16 Correct 8 ms 892 KB Output is correct
17 Correct 4 ms 632 KB Output is correct
18 Correct 6 ms 760 KB Output is correct
19 Correct 7 ms 760 KB Output is correct
20 Correct 8 ms 888 KB Output is correct
21 Correct 28 ms 1400 KB Output is correct
22 Correct 36 ms 1536 KB Output is correct
23 Correct 18 ms 1144 KB Output is correct
24 Correct 56 ms 1912 KB Output is correct
25 Correct 58 ms 1832 KB Output is correct
26 Correct 63 ms 1912 KB Output is correct
27 Correct 63 ms 1912 KB Output is correct
28 Correct 63 ms 1884 KB Output is correct
29 Correct 63 ms 1912 KB Output is correct
30 Correct 62 ms 2060 KB Output is correct
31 Correct 64 ms 1944 KB Output is correct
32 Correct 65 ms 1912 KB Output is correct
33 Correct 64 ms 1912 KB Output is correct
34 Correct 62 ms 2008 KB Output is correct
35 Correct 63 ms 1916 KB Output is correct
36 Correct 65 ms 1932 KB Output is correct
37 Correct 251 ms 3584 KB Output is correct
38 Correct 249 ms 3612 KB Output is correct
39 Correct 373 ms 4088 KB Output is correct
40 Correct 445 ms 4732 KB Output is correct
41 Correct 438 ms 4472 KB Output is correct
42 Correct 411 ms 4344 KB Output is correct
43 Correct 376 ms 4460 KB Output is correct
44 Correct 387 ms 4428 KB Output is correct
45 Correct 392 ms 4600 KB Output is correct
46 Correct 428 ms 4516 KB Output is correct
47 Correct 389 ms 4496 KB Output is correct
48 Correct 391 ms 4420 KB Output is correct
49 Correct 369 ms 4244 KB Output is correct
50 Correct 381 ms 4504 KB Output is correct
51 Correct 2 ms 376 KB Output is correct
52 Correct 453 ms 4984 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 504 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 3 ms 504 KB Output is correct
6 Correct 3 ms 504 KB Output is correct
7 Correct 2 ms 504 KB Output is correct
8 Correct 3 ms 504 KB Output is correct
9 Correct 3 ms 504 KB Output is correct
10 Correct 8 ms 888 KB Output is correct
11 Correct 9 ms 888 KB Output is correct
12 Correct 8 ms 888 KB Output is correct
13 Correct 7 ms 764 KB Output is correct
14 Correct 7 ms 888 KB Output is correct
15 Correct 7 ms 888 KB Output is correct
16 Correct 8 ms 892 KB Output is correct
17 Correct 4 ms 632 KB Output is correct
18 Correct 6 ms 760 KB Output is correct
19 Correct 7 ms 760 KB Output is correct
20 Correct 8 ms 888 KB Output is correct
21 Correct 28 ms 1400 KB Output is correct
22 Correct 36 ms 1536 KB Output is correct
23 Correct 18 ms 1144 KB Output is correct
24 Correct 56 ms 1912 KB Output is correct
25 Correct 58 ms 1832 KB Output is correct
26 Correct 63 ms 1912 KB Output is correct
27 Correct 63 ms 1912 KB Output is correct
28 Correct 63 ms 1884 KB Output is correct
29 Correct 63 ms 1912 KB Output is correct
30 Correct 62 ms 2060 KB Output is correct
31 Correct 64 ms 1944 KB Output is correct
32 Correct 65 ms 1912 KB Output is correct
33 Correct 64 ms 1912 KB Output is correct
34 Correct 62 ms 2008 KB Output is correct
35 Correct 63 ms 1916 KB Output is correct
36 Correct 65 ms 1932 KB Output is correct
37 Correct 251 ms 3584 KB Output is correct
38 Correct 249 ms 3612 KB Output is correct
39 Correct 373 ms 4088 KB Output is correct
40 Correct 445 ms 4732 KB Output is correct
41 Correct 438 ms 4472 KB Output is correct
42 Correct 411 ms 4344 KB Output is correct
43 Correct 376 ms 4460 KB Output is correct
44 Correct 387 ms 4428 KB Output is correct
45 Correct 392 ms 4600 KB Output is correct
46 Correct 428 ms 4516 KB Output is correct
47 Correct 389 ms 4496 KB Output is correct
48 Correct 391 ms 4420 KB Output is correct
49 Correct 369 ms 4244 KB Output is correct
50 Correct 381 ms 4504 KB Output is correct
51 Correct 2 ms 376 KB Output is correct
52 Correct 453 ms 4984 KB Output is correct
53 Correct 560 ms 5264 KB Output is correct
54 Correct 760 ms 6040 KB Output is correct
55 Correct 788 ms 6340 KB Output is correct
56 Correct 591 ms 5372 KB Output is correct
57 Correct 777 ms 6524 KB Output is correct
58 Correct 752 ms 6196 KB Output is correct
59 Correct 793 ms 6312 KB Output is correct
60 Correct 2 ms 376 KB Output is correct
61 Correct 771 ms 6368 KB Output is correct
62 Correct 653 ms 5924 KB Output is correct
63 Correct 660 ms 5884 KB Output is correct
64 Correct 639 ms 5820 KB Output is correct
65 Correct 598 ms 5340 KB Output is correct
66 Correct 691 ms 5360 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 504 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 3 ms 504 KB Output is correct
6 Correct 3 ms 504 KB Output is correct
7 Correct 2 ms 504 KB Output is correct
8 Correct 3 ms 504 KB Output is correct
9 Correct 3 ms 504 KB Output is correct
10 Correct 8 ms 888 KB Output is correct
11 Correct 9 ms 888 KB Output is correct
12 Correct 8 ms 888 KB Output is correct
13 Correct 7 ms 764 KB Output is correct
14 Correct 7 ms 888 KB Output is correct
15 Correct 7 ms 888 KB Output is correct
16 Correct 8 ms 892 KB Output is correct
17 Correct 4 ms 632 KB Output is correct
18 Correct 6 ms 760 KB Output is correct
19 Correct 7 ms 760 KB Output is correct
20 Correct 8 ms 888 KB Output is correct
21 Correct 28 ms 1400 KB Output is correct
22 Correct 36 ms 1536 KB Output is correct
23 Correct 18 ms 1144 KB Output is correct
24 Correct 56 ms 1912 KB Output is correct
25 Correct 58 ms 1832 KB Output is correct
26 Correct 63 ms 1912 KB Output is correct
27 Correct 63 ms 1912 KB Output is correct
28 Correct 63 ms 1884 KB Output is correct
29 Correct 63 ms 1912 KB Output is correct
30 Correct 62 ms 2060 KB Output is correct
31 Correct 64 ms 1944 KB Output is correct
32 Correct 65 ms 1912 KB Output is correct
33 Correct 64 ms 1912 KB Output is correct
34 Correct 62 ms 2008 KB Output is correct
35 Correct 63 ms 1916 KB Output is correct
36 Correct 65 ms 1932 KB Output is correct
37 Correct 251 ms 3584 KB Output is correct
38 Correct 249 ms 3612 KB Output is correct
39 Correct 373 ms 4088 KB Output is correct
40 Correct 445 ms 4732 KB Output is correct
41 Correct 438 ms 4472 KB Output is correct
42 Correct 411 ms 4344 KB Output is correct
43 Correct 376 ms 4460 KB Output is correct
44 Correct 387 ms 4428 KB Output is correct
45 Correct 392 ms 4600 KB Output is correct
46 Correct 428 ms 4516 KB Output is correct
47 Correct 389 ms 4496 KB Output is correct
48 Correct 391 ms 4420 KB Output is correct
49 Correct 369 ms 4244 KB Output is correct
50 Correct 381 ms 4504 KB Output is correct
51 Correct 2 ms 376 KB Output is correct
52 Correct 453 ms 4984 KB Output is correct
53 Correct 560 ms 5264 KB Output is correct
54 Correct 760 ms 6040 KB Output is correct
55 Correct 788 ms 6340 KB Output is correct
56 Correct 591 ms 5372 KB Output is correct
57 Correct 777 ms 6524 KB Output is correct
58 Correct 752 ms 6196 KB Output is correct
59 Correct 793 ms 6312 KB Output is correct
60 Correct 2 ms 376 KB Output is correct
61 Correct 771 ms 6368 KB Output is correct
62 Correct 653 ms 5924 KB Output is correct
63 Correct 660 ms 5884 KB Output is correct
64 Correct 639 ms 5820 KB Output is correct
65 Correct 598 ms 5340 KB Output is correct
66 Correct 691 ms 5360 KB Output is correct
67 Correct 990 ms 7056 KB Output is correct
68 Correct 5 ms 376 KB Output is correct
69 Execution timed out 1083 ms 6008 KB Time limit exceeded
70 Halted 0 ms 0 KB -