Submission #686768

# Submission time Handle Problem Language Result Execution time Memory
686768 2023-01-25T23:23:04 Z tolbi Bootfall (IZhO17_bootfall) C++17
100 / 100
959 ms 8048 KB
    #pragma optimize("Bismillahirrahmanirrahim")
    //█▀█─█──█──█▀█─█─█
    //█▄█─█──█──█▄█─█■█
    //█─█─█▄─█▄─█─█─█─█
    //Allahuekber
    //ahmet23 orz...
    //Sani buyuk Osman Pasa Plevneden cikmam diyor.
    //FatihSultanMehmedHan
    //YavuzSultanSelimHan
    //AbdulhamidHan
    #define author tolbi
    #include <bits/stdc++.h>
    #ifdef LOCAL
    	#include "23.h"
    #endif
    #define int long long
    #define endl '\n'
    #define vint(x) vector<int> x
    #define deci(x) int x;cin>>x;
    #define decstr(x) string x;cin>>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 det(x) cout<<"NO\0YES"+x*3<<endl;
    #define INF LONG_LONG_MAX
    #define rev(x) reverse(x.begin(),x.end());
    #define ios ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    #define tol(bi) (1LL<<((int)(bi)))
    const int MOD = 1e9+7;
    using namespace std;
    mt19937 ayahya(chrono::high_resolution_clock().now().time_since_epoch().count());
    int32_t main(){
    	ios;
    	int t=1;
    	int tno = 0;
    	if (!t) cin>>t;
    	while (t-(tno++)){
    		deci(n);
    		vint(arr(n));
    		cinarr(arr);
    		vector<int> ansarr(252323,0);
    		ansarr[0]=1;
    		int sum = 0;
    		for (int i = 0; i < n; i++){
    			sum+=arr[i];
    			for(int j = 250000; j >= arr[i]; j--){
    				ansarr[j] += ansarr[j-arr[i]];
    			}
    		}
    		if (sum%2 || ansarr[sum/2]==0){
    			cout<<0<<endl;
    			continue;
    		}
    		vector<int> kk(500001,0);
    		for (int i = 0; i < n; i++){
    			for (int j = 0; j <= 250000; j++){
    				if (ansarr[j] && j*2>=sum-arr[i]) {
    					kk[j*2-sum+arr[i]]++;
    				}
    				if (j<=250000-arr[i]) {
    					ansarr[j+arr[i]]-=ansarr[j];
    				}
    			}
    			for (int j = 250000-arr[i]; j >= 0; j--){
    				ansarr[j+arr[i]]+=ansarr[j];
    			}
    		}
    		vector<int> hueh;
    		for (int i = 1; i < kk.size(); i++){
    			if (kk[i]==n) hueh.push_back(i);
    		}
    		cout<<hueh.size()<<endl;
    		coutarr(hueh);
    	}
    }

Compilation message

bootfall.cpp:1: warning: ignoring '#pragma optimize ' [-Wunknown-pragmas]
    1 |     #pragma optimize("Bismillahirrahmanirrahim")
      | 
bootfall.cpp: In function 'int32_t main()':
bootfall.cpp:70:25: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   70 |       for (int i = 1; i < kk.size(); i++){
      |                       ~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 10 ms 6100 KB Output is correct
2 Correct 13 ms 6100 KB Output is correct
3 Correct 1 ms 2260 KB Output is correct
4 Correct 10 ms 6100 KB Output is correct
5 Correct 24 ms 6100 KB Output is correct
6 Correct 17 ms 6100 KB Output is correct
7 Correct 14 ms 6100 KB Output is correct
8 Correct 23 ms 6232 KB Output is correct
9 Correct 21 ms 6224 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 6100 KB Output is correct
2 Correct 13 ms 6100 KB Output is correct
3 Correct 1 ms 2260 KB Output is correct
4 Correct 10 ms 6100 KB Output is correct
5 Correct 24 ms 6100 KB Output is correct
6 Correct 17 ms 6100 KB Output is correct
7 Correct 14 ms 6100 KB Output is correct
8 Correct 23 ms 6232 KB Output is correct
9 Correct 21 ms 6224 KB Output is correct
10 Correct 52 ms 6148 KB Output is correct
11 Correct 52 ms 6204 KB Output is correct
12 Correct 52 ms 6200 KB Output is correct
13 Correct 45 ms 6172 KB Output is correct
14 Correct 50 ms 6204 KB Output is correct
15 Correct 48 ms 6220 KB Output is correct
16 Correct 52 ms 6148 KB Output is correct
17 Correct 28 ms 6144 KB Output is correct
18 Correct 43 ms 6204 KB Output is correct
19 Correct 40 ms 6204 KB Output is correct
20 Correct 54 ms 6208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 6100 KB Output is correct
2 Correct 13 ms 6100 KB Output is correct
3 Correct 1 ms 2260 KB Output is correct
4 Correct 10 ms 6100 KB Output is correct
5 Correct 24 ms 6100 KB Output is correct
6 Correct 17 ms 6100 KB Output is correct
7 Correct 14 ms 6100 KB Output is correct
8 Correct 23 ms 6232 KB Output is correct
9 Correct 21 ms 6224 KB Output is correct
10 Correct 52 ms 6148 KB Output is correct
11 Correct 52 ms 6204 KB Output is correct
12 Correct 52 ms 6200 KB Output is correct
13 Correct 45 ms 6172 KB Output is correct
14 Correct 50 ms 6204 KB Output is correct
15 Correct 48 ms 6220 KB Output is correct
16 Correct 52 ms 6148 KB Output is correct
17 Correct 28 ms 6144 KB Output is correct
18 Correct 43 ms 6204 KB Output is correct
19 Correct 40 ms 6204 KB Output is correct
20 Correct 54 ms 6208 KB Output is correct
21 Correct 109 ms 6204 KB Output is correct
22 Correct 123 ms 6204 KB Output is correct
23 Correct 86 ms 6236 KB Output is correct
24 Correct 141 ms 6208 KB Output is correct
25 Correct 146 ms 6212 KB Output is correct
26 Correct 160 ms 6208 KB Output is correct
27 Correct 159 ms 6208 KB Output is correct
28 Correct 166 ms 6200 KB Output is correct
29 Correct 136 ms 6332 KB Output is correct
30 Correct 160 ms 6268 KB Output is correct
31 Correct 134 ms 6196 KB Output is correct
32 Correct 164 ms 6204 KB Output is correct
33 Correct 166 ms 6200 KB Output is correct
34 Correct 165 ms 6208 KB Output is correct
35 Correct 167 ms 6200 KB Output is correct
36 Correct 134 ms 6204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 6100 KB Output is correct
2 Correct 13 ms 6100 KB Output is correct
3 Correct 1 ms 2260 KB Output is correct
4 Correct 10 ms 6100 KB Output is correct
5 Correct 24 ms 6100 KB Output is correct
6 Correct 17 ms 6100 KB Output is correct
7 Correct 14 ms 6100 KB Output is correct
8 Correct 23 ms 6232 KB Output is correct
9 Correct 21 ms 6224 KB Output is correct
10 Correct 52 ms 6148 KB Output is correct
11 Correct 52 ms 6204 KB Output is correct
12 Correct 52 ms 6200 KB Output is correct
13 Correct 45 ms 6172 KB Output is correct
14 Correct 50 ms 6204 KB Output is correct
15 Correct 48 ms 6220 KB Output is correct
16 Correct 52 ms 6148 KB Output is correct
17 Correct 28 ms 6144 KB Output is correct
18 Correct 43 ms 6204 KB Output is correct
19 Correct 40 ms 6204 KB Output is correct
20 Correct 54 ms 6208 KB Output is correct
21 Correct 109 ms 6204 KB Output is correct
22 Correct 123 ms 6204 KB Output is correct
23 Correct 86 ms 6236 KB Output is correct
24 Correct 141 ms 6208 KB Output is correct
25 Correct 146 ms 6212 KB Output is correct
26 Correct 160 ms 6208 KB Output is correct
27 Correct 159 ms 6208 KB Output is correct
28 Correct 166 ms 6200 KB Output is correct
29 Correct 136 ms 6332 KB Output is correct
30 Correct 160 ms 6268 KB Output is correct
31 Correct 134 ms 6196 KB Output is correct
32 Correct 164 ms 6204 KB Output is correct
33 Correct 166 ms 6200 KB Output is correct
34 Correct 165 ms 6208 KB Output is correct
35 Correct 167 ms 6200 KB Output is correct
36 Correct 134 ms 6204 KB Output is correct
37 Correct 281 ms 6460 KB Output is correct
38 Correct 324 ms 6460 KB Output is correct
39 Correct 390 ms 6204 KB Output is correct
40 Correct 466 ms 6464 KB Output is correct
41 Correct 426 ms 6204 KB Output is correct
42 Correct 398 ms 6516 KB Output is correct
43 Correct 377 ms 6652 KB Output is correct
44 Correct 414 ms 6592 KB Output is correct
45 Correct 374 ms 6672 KB Output is correct
46 Correct 416 ms 6140 KB Output is correct
47 Correct 408 ms 6512 KB Output is correct
48 Correct 414 ms 6588 KB Output is correct
49 Correct 410 ms 6332 KB Output is correct
50 Correct 380 ms 6556 KB Output is correct
51 Correct 44 ms 2260 KB Output is correct
52 Correct 461 ms 6808 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 6100 KB Output is correct
2 Correct 13 ms 6100 KB Output is correct
3 Correct 1 ms 2260 KB Output is correct
4 Correct 10 ms 6100 KB Output is correct
5 Correct 24 ms 6100 KB Output is correct
6 Correct 17 ms 6100 KB Output is correct
7 Correct 14 ms 6100 KB Output is correct
8 Correct 23 ms 6232 KB Output is correct
9 Correct 21 ms 6224 KB Output is correct
10 Correct 52 ms 6148 KB Output is correct
11 Correct 52 ms 6204 KB Output is correct
12 Correct 52 ms 6200 KB Output is correct
13 Correct 45 ms 6172 KB Output is correct
14 Correct 50 ms 6204 KB Output is correct
15 Correct 48 ms 6220 KB Output is correct
16 Correct 52 ms 6148 KB Output is correct
17 Correct 28 ms 6144 KB Output is correct
18 Correct 43 ms 6204 KB Output is correct
19 Correct 40 ms 6204 KB Output is correct
20 Correct 54 ms 6208 KB Output is correct
21 Correct 109 ms 6204 KB Output is correct
22 Correct 123 ms 6204 KB Output is correct
23 Correct 86 ms 6236 KB Output is correct
24 Correct 141 ms 6208 KB Output is correct
25 Correct 146 ms 6212 KB Output is correct
26 Correct 160 ms 6208 KB Output is correct
27 Correct 159 ms 6208 KB Output is correct
28 Correct 166 ms 6200 KB Output is correct
29 Correct 136 ms 6332 KB Output is correct
30 Correct 160 ms 6268 KB Output is correct
31 Correct 134 ms 6196 KB Output is correct
32 Correct 164 ms 6204 KB Output is correct
33 Correct 166 ms 6200 KB Output is correct
34 Correct 165 ms 6208 KB Output is correct
35 Correct 167 ms 6200 KB Output is correct
36 Correct 134 ms 6204 KB Output is correct
37 Correct 281 ms 6460 KB Output is correct
38 Correct 324 ms 6460 KB Output is correct
39 Correct 390 ms 6204 KB Output is correct
40 Correct 466 ms 6464 KB Output is correct
41 Correct 426 ms 6204 KB Output is correct
42 Correct 398 ms 6516 KB Output is correct
43 Correct 377 ms 6652 KB Output is correct
44 Correct 414 ms 6592 KB Output is correct
45 Correct 374 ms 6672 KB Output is correct
46 Correct 416 ms 6140 KB Output is correct
47 Correct 408 ms 6512 KB Output is correct
48 Correct 414 ms 6588 KB Output is correct
49 Correct 410 ms 6332 KB Output is correct
50 Correct 380 ms 6556 KB Output is correct
51 Correct 44 ms 2260 KB Output is correct
52 Correct 461 ms 6808 KB Output is correct
53 Correct 512 ms 6596 KB Output is correct
54 Correct 594 ms 6592 KB Output is correct
55 Correct 559 ms 7028 KB Output is correct
56 Correct 473 ms 6648 KB Output is correct
57 Correct 610 ms 6972 KB Output is correct
58 Correct 600 ms 6716 KB Output is correct
59 Correct 588 ms 6852 KB Output is correct
60 Correct 59 ms 2260 KB Output is correct
61 Correct 598 ms 6844 KB Output is correct
62 Correct 554 ms 6972 KB Output is correct
63 Correct 540 ms 6972 KB Output is correct
64 Correct 529 ms 6976 KB Output is correct
65 Correct 512 ms 6220 KB Output is correct
66 Correct 495 ms 6292 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 6100 KB Output is correct
2 Correct 13 ms 6100 KB Output is correct
3 Correct 1 ms 2260 KB Output is correct
4 Correct 10 ms 6100 KB Output is correct
5 Correct 24 ms 6100 KB Output is correct
6 Correct 17 ms 6100 KB Output is correct
7 Correct 14 ms 6100 KB Output is correct
8 Correct 23 ms 6232 KB Output is correct
9 Correct 21 ms 6224 KB Output is correct
10 Correct 52 ms 6148 KB Output is correct
11 Correct 52 ms 6204 KB Output is correct
12 Correct 52 ms 6200 KB Output is correct
13 Correct 45 ms 6172 KB Output is correct
14 Correct 50 ms 6204 KB Output is correct
15 Correct 48 ms 6220 KB Output is correct
16 Correct 52 ms 6148 KB Output is correct
17 Correct 28 ms 6144 KB Output is correct
18 Correct 43 ms 6204 KB Output is correct
19 Correct 40 ms 6204 KB Output is correct
20 Correct 54 ms 6208 KB Output is correct
21 Correct 109 ms 6204 KB Output is correct
22 Correct 123 ms 6204 KB Output is correct
23 Correct 86 ms 6236 KB Output is correct
24 Correct 141 ms 6208 KB Output is correct
25 Correct 146 ms 6212 KB Output is correct
26 Correct 160 ms 6208 KB Output is correct
27 Correct 159 ms 6208 KB Output is correct
28 Correct 166 ms 6200 KB Output is correct
29 Correct 136 ms 6332 KB Output is correct
30 Correct 160 ms 6268 KB Output is correct
31 Correct 134 ms 6196 KB Output is correct
32 Correct 164 ms 6204 KB Output is correct
33 Correct 166 ms 6200 KB Output is correct
34 Correct 165 ms 6208 KB Output is correct
35 Correct 167 ms 6200 KB Output is correct
36 Correct 134 ms 6204 KB Output is correct
37 Correct 281 ms 6460 KB Output is correct
38 Correct 324 ms 6460 KB Output is correct
39 Correct 390 ms 6204 KB Output is correct
40 Correct 466 ms 6464 KB Output is correct
41 Correct 426 ms 6204 KB Output is correct
42 Correct 398 ms 6516 KB Output is correct
43 Correct 377 ms 6652 KB Output is correct
44 Correct 414 ms 6592 KB Output is correct
45 Correct 374 ms 6672 KB Output is correct
46 Correct 416 ms 6140 KB Output is correct
47 Correct 408 ms 6512 KB Output is correct
48 Correct 414 ms 6588 KB Output is correct
49 Correct 410 ms 6332 KB Output is correct
50 Correct 380 ms 6556 KB Output is correct
51 Correct 44 ms 2260 KB Output is correct
52 Correct 461 ms 6808 KB Output is correct
53 Correct 512 ms 6596 KB Output is correct
54 Correct 594 ms 6592 KB Output is correct
55 Correct 559 ms 7028 KB Output is correct
56 Correct 473 ms 6648 KB Output is correct
57 Correct 610 ms 6972 KB Output is correct
58 Correct 600 ms 6716 KB Output is correct
59 Correct 588 ms 6852 KB Output is correct
60 Correct 59 ms 2260 KB Output is correct
61 Correct 598 ms 6844 KB Output is correct
62 Correct 554 ms 6972 KB Output is correct
63 Correct 540 ms 6972 KB Output is correct
64 Correct 529 ms 6976 KB Output is correct
65 Correct 512 ms 6220 KB Output is correct
66 Correct 495 ms 6292 KB Output is correct
67 Correct 672 ms 6848 KB Output is correct
68 Correct 99 ms 2260 KB Output is correct
69 Correct 937 ms 7800 KB Output is correct
70 Correct 854 ms 7228 KB Output is correct
71 Correct 881 ms 7116 KB Output is correct
72 Correct 867 ms 6216 KB Output is correct
73 Correct 866 ms 6220 KB Output is correct
74 Correct 938 ms 7880 KB Output is correct
75 Correct 903 ms 7540 KB Output is correct
76 Correct 944 ms 7736 KB Output is correct
77 Correct 959 ms 8048 KB Output is correct