# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
685231 |
2023-01-23T17:41:58 Z |
tolbi |
Bootfall (IZhO17_bootfall) |
C++17 |
|
1000 ms |
55028 KB |
#pragma optimize("Bismillahirrahmanirrahim")
//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█■█
//█─█─█▄─█▄─█─█─█─█
//Allahuekber
//ahmet23 orz...
//FatihSultanMehmedHan
//YavuzSultanSelimHan
//AbdulhamidHan
//Sani buyuk Osman Pasa Plevneden cikmam diyor.
#define author tolbi
#include<bits/stdc++.h>
#define endl '\n'
#define deci(x) int x;cin>>x;
#define decstr(x) string x;cin>>x;
#define vint(x) vector<int> x
#define cinarr(x) for (auto &it : x) cin>>it;
#define coutarr(x) for (auto &it : x) cout<<it<<" ";cout<<endl;
#define sortarr(x) sort(x.begin(), x.end())
#define sortrarr(x) sort(x.rbegin(), x.rend())
#define revarr(x) reverse(x.begin(), x.end())
#define tol(bi) (1LL<<((int)(bi)))
#define INF LONG_LONG_MAX
using namespace std;
mt19937 ayahya(chrono::high_resolution_clock().now().time_since_epoch().count());
const int MOD = 1e9+7;
int32_t main(){
int T=1;
int tno=0;
if (!T) cin>>T;
while (T-(tno++)){
deci(n);
vint(arr(n));
cinarr(arr);
int somma = 0; for (int i = 0; i < n; i++) somma+=arr[i];
vector<vector<vector<bitset<500>>>> dp(2,vector<vector<bitset<500>>>(somma+1,vector<bitset<500>>(2)));
for (int i = 0; i < n; ++i)
{
dp[0][0][1][i]=true;
}
bitset<500> bos;
for (int node = 1; node <= n; node++){
for (int crr = 0; crr <= somma; crr++){
for (int flag = 0; flag < 2; flag++){
dp[1][crr][flag]&=bos;
if (!flag){
dp[1][crr][flag][node-1]=true;
dp[1][crr][flag]&=dp[0][crr][1];
}
if (abs(crr-arr[node-1])<=somma) dp[1][crr][flag]|=dp[0][abs(crr-arr[node-1])][flag];
if (abs(crr+arr[node-1])<=somma) dp[1][crr][flag]|=dp[0][abs(crr+arr[node-1])][flag];
}
}
swap(dp[0],dp[1]);
}
if (dp[0][0][1].count()==0){
cout<<0<<endl;
continue;
}
vector<int> say;
for (int i = 1; i < somma; i++){
if (dp[0][i][0].count()==n){
say.push_back(i);
}
}
cout<<say.size()<<endl;
coutarr(say);
}
}
Compilation message
bootfall.cpp:1: warning: ignoring '#pragma optimize ' [-Wunknown-pragmas]
1 | #pragma optimize("Bismillahirrahmanirrahim")
|
bootfall.cpp: In function 'int32_t main()':
bootfall.cpp:62:27: warning: comparison of integer expressions of different signedness: 'std::size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
62 | if (dp[0][i][0].count()==n){
| ~~~~~~~~~~~~~~~~~~~^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
596 KB |
Output is correct |
5 |
Correct |
2 ms |
724 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
2 ms |
980 KB |
Output is correct |
9 |
Correct |
1 ms |
468 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
596 KB |
Output is correct |
5 |
Correct |
2 ms |
724 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
2 ms |
980 KB |
Output is correct |
9 |
Correct |
1 ms |
468 KB |
Output is correct |
10 |
Correct |
1 ms |
468 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
468 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Correct |
1 ms |
340 KB |
Output is correct |
19 |
Correct |
0 ms |
340 KB |
Output is correct |
20 |
Correct |
1 ms |
468 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
596 KB |
Output is correct |
5 |
Correct |
2 ms |
724 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
2 ms |
980 KB |
Output is correct |
9 |
Correct |
1 ms |
468 KB |
Output is correct |
10 |
Correct |
1 ms |
468 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
468 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Correct |
1 ms |
340 KB |
Output is correct |
19 |
Correct |
0 ms |
340 KB |
Output is correct |
20 |
Correct |
1 ms |
468 KB |
Output is correct |
21 |
Correct |
7 ms |
1748 KB |
Output is correct |
22 |
Correct |
8 ms |
1876 KB |
Output is correct |
23 |
Correct |
5 ms |
1364 KB |
Output is correct |
24 |
Correct |
15 ms |
2572 KB |
Output is correct |
25 |
Correct |
34 ms |
4692 KB |
Output is correct |
26 |
Correct |
33 ms |
4948 KB |
Output is correct |
27 |
Correct |
27 ms |
4564 KB |
Output is correct |
28 |
Correct |
29 ms |
4948 KB |
Output is correct |
29 |
Correct |
32 ms |
5108 KB |
Output is correct |
30 |
Correct |
18 ms |
2772 KB |
Output is correct |
31 |
Correct |
24 ms |
3924 KB |
Output is correct |
32 |
Correct |
15 ms |
2644 KB |
Output is correct |
33 |
Correct |
34 ms |
5204 KB |
Output is correct |
34 |
Correct |
30 ms |
5076 KB |
Output is correct |
35 |
Correct |
32 ms |
5076 KB |
Output is correct |
36 |
Correct |
20 ms |
2516 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
596 KB |
Output is correct |
5 |
Correct |
2 ms |
724 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
2 ms |
980 KB |
Output is correct |
9 |
Correct |
1 ms |
468 KB |
Output is correct |
10 |
Correct |
1 ms |
468 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
468 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Correct |
1 ms |
340 KB |
Output is correct |
19 |
Correct |
0 ms |
340 KB |
Output is correct |
20 |
Correct |
1 ms |
468 KB |
Output is correct |
21 |
Correct |
7 ms |
1748 KB |
Output is correct |
22 |
Correct |
8 ms |
1876 KB |
Output is correct |
23 |
Correct |
5 ms |
1364 KB |
Output is correct |
24 |
Correct |
15 ms |
2572 KB |
Output is correct |
25 |
Correct |
34 ms |
4692 KB |
Output is correct |
26 |
Correct |
33 ms |
4948 KB |
Output is correct |
27 |
Correct |
27 ms |
4564 KB |
Output is correct |
28 |
Correct |
29 ms |
4948 KB |
Output is correct |
29 |
Correct |
32 ms |
5108 KB |
Output is correct |
30 |
Correct |
18 ms |
2772 KB |
Output is correct |
31 |
Correct |
24 ms |
3924 KB |
Output is correct |
32 |
Correct |
15 ms |
2644 KB |
Output is correct |
33 |
Correct |
34 ms |
5204 KB |
Output is correct |
34 |
Correct |
30 ms |
5076 KB |
Output is correct |
35 |
Correct |
32 ms |
5076 KB |
Output is correct |
36 |
Correct |
20 ms |
2516 KB |
Output is correct |
37 |
Correct |
121 ms |
9764 KB |
Output is correct |
38 |
Correct |
116 ms |
10068 KB |
Output is correct |
39 |
Correct |
496 ms |
30660 KB |
Output is correct |
40 |
Correct |
267 ms |
16212 KB |
Output is correct |
41 |
Correct |
702 ms |
36180 KB |
Output is correct |
42 |
Correct |
225 ms |
15060 KB |
Output is correct |
43 |
Correct |
434 ms |
27424 KB |
Output is correct |
44 |
Correct |
452 ms |
27860 KB |
Output is correct |
45 |
Correct |
485 ms |
28116 KB |
Output is correct |
46 |
Correct |
254 ms |
15840 KB |
Output is correct |
47 |
Correct |
295 ms |
16284 KB |
Output is correct |
48 |
Correct |
476 ms |
30516 KB |
Output is correct |
49 |
Correct |
518 ms |
30676 KB |
Output is correct |
50 |
Correct |
307 ms |
16340 KB |
Output is correct |
51 |
Correct |
257 ms |
15772 KB |
Output is correct |
52 |
Correct |
597 ms |
34772 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
596 KB |
Output is correct |
5 |
Correct |
2 ms |
724 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
2 ms |
980 KB |
Output is correct |
9 |
Correct |
1 ms |
468 KB |
Output is correct |
10 |
Correct |
1 ms |
468 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
468 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Correct |
1 ms |
340 KB |
Output is correct |
19 |
Correct |
0 ms |
340 KB |
Output is correct |
20 |
Correct |
1 ms |
468 KB |
Output is correct |
21 |
Correct |
7 ms |
1748 KB |
Output is correct |
22 |
Correct |
8 ms |
1876 KB |
Output is correct |
23 |
Correct |
5 ms |
1364 KB |
Output is correct |
24 |
Correct |
15 ms |
2572 KB |
Output is correct |
25 |
Correct |
34 ms |
4692 KB |
Output is correct |
26 |
Correct |
33 ms |
4948 KB |
Output is correct |
27 |
Correct |
27 ms |
4564 KB |
Output is correct |
28 |
Correct |
29 ms |
4948 KB |
Output is correct |
29 |
Correct |
32 ms |
5108 KB |
Output is correct |
30 |
Correct |
18 ms |
2772 KB |
Output is correct |
31 |
Correct |
24 ms |
3924 KB |
Output is correct |
32 |
Correct |
15 ms |
2644 KB |
Output is correct |
33 |
Correct |
34 ms |
5204 KB |
Output is correct |
34 |
Correct |
30 ms |
5076 KB |
Output is correct |
35 |
Correct |
32 ms |
5076 KB |
Output is correct |
36 |
Correct |
20 ms |
2516 KB |
Output is correct |
37 |
Correct |
121 ms |
9764 KB |
Output is correct |
38 |
Correct |
116 ms |
10068 KB |
Output is correct |
39 |
Correct |
496 ms |
30660 KB |
Output is correct |
40 |
Correct |
267 ms |
16212 KB |
Output is correct |
41 |
Correct |
702 ms |
36180 KB |
Output is correct |
42 |
Correct |
225 ms |
15060 KB |
Output is correct |
43 |
Correct |
434 ms |
27424 KB |
Output is correct |
44 |
Correct |
452 ms |
27860 KB |
Output is correct |
45 |
Correct |
485 ms |
28116 KB |
Output is correct |
46 |
Correct |
254 ms |
15840 KB |
Output is correct |
47 |
Correct |
295 ms |
16284 KB |
Output is correct |
48 |
Correct |
476 ms |
30516 KB |
Output is correct |
49 |
Correct |
518 ms |
30676 KB |
Output is correct |
50 |
Correct |
307 ms |
16340 KB |
Output is correct |
51 |
Correct |
257 ms |
15772 KB |
Output is correct |
52 |
Correct |
597 ms |
34772 KB |
Output is correct |
53 |
Correct |
439 ms |
22740 KB |
Output is correct |
54 |
Correct |
602 ms |
27604 KB |
Output is correct |
55 |
Execution timed out |
1082 ms |
55028 KB |
Time limit exceeded |
56 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
596 KB |
Output is correct |
5 |
Correct |
2 ms |
724 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
2 ms |
980 KB |
Output is correct |
9 |
Correct |
1 ms |
468 KB |
Output is correct |
10 |
Correct |
1 ms |
468 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
468 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Correct |
1 ms |
340 KB |
Output is correct |
19 |
Correct |
0 ms |
340 KB |
Output is correct |
20 |
Correct |
1 ms |
468 KB |
Output is correct |
21 |
Correct |
7 ms |
1748 KB |
Output is correct |
22 |
Correct |
8 ms |
1876 KB |
Output is correct |
23 |
Correct |
5 ms |
1364 KB |
Output is correct |
24 |
Correct |
15 ms |
2572 KB |
Output is correct |
25 |
Correct |
34 ms |
4692 KB |
Output is correct |
26 |
Correct |
33 ms |
4948 KB |
Output is correct |
27 |
Correct |
27 ms |
4564 KB |
Output is correct |
28 |
Correct |
29 ms |
4948 KB |
Output is correct |
29 |
Correct |
32 ms |
5108 KB |
Output is correct |
30 |
Correct |
18 ms |
2772 KB |
Output is correct |
31 |
Correct |
24 ms |
3924 KB |
Output is correct |
32 |
Correct |
15 ms |
2644 KB |
Output is correct |
33 |
Correct |
34 ms |
5204 KB |
Output is correct |
34 |
Correct |
30 ms |
5076 KB |
Output is correct |
35 |
Correct |
32 ms |
5076 KB |
Output is correct |
36 |
Correct |
20 ms |
2516 KB |
Output is correct |
37 |
Correct |
121 ms |
9764 KB |
Output is correct |
38 |
Correct |
116 ms |
10068 KB |
Output is correct |
39 |
Correct |
496 ms |
30660 KB |
Output is correct |
40 |
Correct |
267 ms |
16212 KB |
Output is correct |
41 |
Correct |
702 ms |
36180 KB |
Output is correct |
42 |
Correct |
225 ms |
15060 KB |
Output is correct |
43 |
Correct |
434 ms |
27424 KB |
Output is correct |
44 |
Correct |
452 ms |
27860 KB |
Output is correct |
45 |
Correct |
485 ms |
28116 KB |
Output is correct |
46 |
Correct |
254 ms |
15840 KB |
Output is correct |
47 |
Correct |
295 ms |
16284 KB |
Output is correct |
48 |
Correct |
476 ms |
30516 KB |
Output is correct |
49 |
Correct |
518 ms |
30676 KB |
Output is correct |
50 |
Correct |
307 ms |
16340 KB |
Output is correct |
51 |
Correct |
257 ms |
15772 KB |
Output is correct |
52 |
Correct |
597 ms |
34772 KB |
Output is correct |
53 |
Correct |
439 ms |
22740 KB |
Output is correct |
54 |
Correct |
602 ms |
27604 KB |
Output is correct |
55 |
Execution timed out |
1082 ms |
55028 KB |
Time limit exceeded |
56 |
Halted |
0 ms |
0 KB |
- |