Submission #686762

# Submission time Handle Problem Language Result Execution time Memory
686762 2023-01-25T23:12:38 Z tolbi Bootfall (IZhO17_bootfall) C++17
100 / 100
966 ms 7924 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 = ansarr.size()-1; 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:68:21: 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]
   68 |   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 14 ms 6100 KB Output is correct
3 Correct 3 ms 2260 KB Output is correct
4 Correct 11 ms 6228 KB Output is correct
5 Correct 25 ms 6100 KB Output is correct
6 Correct 18 ms 6224 KB Output is correct
7 Correct 14 ms 6100 KB Output is correct
8 Correct 25 ms 6100 KB Output is correct
9 Correct 17 ms 6100 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 6100 KB Output is correct
2 Correct 14 ms 6100 KB Output is correct
3 Correct 3 ms 2260 KB Output is correct
4 Correct 11 ms 6228 KB Output is correct
5 Correct 25 ms 6100 KB Output is correct
6 Correct 18 ms 6224 KB Output is correct
7 Correct 14 ms 6100 KB Output is correct
8 Correct 25 ms 6100 KB Output is correct
9 Correct 17 ms 6100 KB Output is correct
10 Correct 52 ms 6152 KB Output is correct
11 Correct 53 ms 6100 KB Output is correct
12 Correct 44 ms 6184 KB Output is correct
13 Correct 42 ms 6148 KB Output is correct
14 Correct 49 ms 6100 KB Output is correct
15 Correct 50 ms 6100 KB Output is correct
16 Correct 54 ms 6100 KB Output is correct
17 Correct 34 ms 6100 KB Output is correct
18 Correct 42 ms 6100 KB Output is correct
19 Correct 46 ms 6100 KB Output is correct
20 Correct 52 ms 6100 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 6100 KB Output is correct
2 Correct 14 ms 6100 KB Output is correct
3 Correct 3 ms 2260 KB Output is correct
4 Correct 11 ms 6228 KB Output is correct
5 Correct 25 ms 6100 KB Output is correct
6 Correct 18 ms 6224 KB Output is correct
7 Correct 14 ms 6100 KB Output is correct
8 Correct 25 ms 6100 KB Output is correct
9 Correct 17 ms 6100 KB Output is correct
10 Correct 52 ms 6152 KB Output is correct
11 Correct 53 ms 6100 KB Output is correct
12 Correct 44 ms 6184 KB Output is correct
13 Correct 42 ms 6148 KB Output is correct
14 Correct 49 ms 6100 KB Output is correct
15 Correct 50 ms 6100 KB Output is correct
16 Correct 54 ms 6100 KB Output is correct
17 Correct 34 ms 6100 KB Output is correct
18 Correct 42 ms 6100 KB Output is correct
19 Correct 46 ms 6100 KB Output is correct
20 Correct 52 ms 6100 KB Output is correct
21 Correct 111 ms 6212 KB Output is correct
22 Correct 127 ms 6204 KB Output is correct
23 Correct 76 ms 6212 KB Output is correct
24 Correct 157 ms 6204 KB Output is correct
25 Correct 137 ms 6228 KB Output is correct
26 Correct 170 ms 6204 KB Output is correct
27 Correct 170 ms 6208 KB Output is correct
28 Correct 167 ms 6216 KB Output is correct
29 Correct 173 ms 6204 KB Output is correct
30 Correct 166 ms 6092 KB Output is correct
31 Correct 166 ms 6204 KB Output is correct
32 Correct 167 ms 6212 KB Output is correct
33 Correct 162 ms 6204 KB Output is correct
34 Correct 166 ms 6204 KB Output is correct
35 Correct 146 ms 6212 KB Output is correct
36 Correct 170 ms 6208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 6100 KB Output is correct
2 Correct 14 ms 6100 KB Output is correct
3 Correct 3 ms 2260 KB Output is correct
4 Correct 11 ms 6228 KB Output is correct
5 Correct 25 ms 6100 KB Output is correct
6 Correct 18 ms 6224 KB Output is correct
7 Correct 14 ms 6100 KB Output is correct
8 Correct 25 ms 6100 KB Output is correct
9 Correct 17 ms 6100 KB Output is correct
10 Correct 52 ms 6152 KB Output is correct
11 Correct 53 ms 6100 KB Output is correct
12 Correct 44 ms 6184 KB Output is correct
13 Correct 42 ms 6148 KB Output is correct
14 Correct 49 ms 6100 KB Output is correct
15 Correct 50 ms 6100 KB Output is correct
16 Correct 54 ms 6100 KB Output is correct
17 Correct 34 ms 6100 KB Output is correct
18 Correct 42 ms 6100 KB Output is correct
19 Correct 46 ms 6100 KB Output is correct
20 Correct 52 ms 6100 KB Output is correct
21 Correct 111 ms 6212 KB Output is correct
22 Correct 127 ms 6204 KB Output is correct
23 Correct 76 ms 6212 KB Output is correct
24 Correct 157 ms 6204 KB Output is correct
25 Correct 137 ms 6228 KB Output is correct
26 Correct 170 ms 6204 KB Output is correct
27 Correct 170 ms 6208 KB Output is correct
28 Correct 167 ms 6216 KB Output is correct
29 Correct 173 ms 6204 KB Output is correct
30 Correct 166 ms 6092 KB Output is correct
31 Correct 166 ms 6204 KB Output is correct
32 Correct 167 ms 6212 KB Output is correct
33 Correct 162 ms 6204 KB Output is correct
34 Correct 166 ms 6204 KB Output is correct
35 Correct 146 ms 6212 KB Output is correct
36 Correct 170 ms 6208 KB Output is correct
37 Correct 322 ms 6464 KB Output is correct
38 Correct 328 ms 6460 KB Output is correct
39 Correct 401 ms 6212 KB Output is correct
40 Correct 449 ms 6476 KB Output is correct
41 Correct 436 ms 6216 KB Output is correct
42 Correct 429 ms 6468 KB Output is correct
43 Correct 431 ms 6588 KB Output is correct
44 Correct 414 ms 6592 KB Output is correct
45 Correct 431 ms 6588 KB Output is correct
46 Correct 430 ms 6212 KB Output is correct
47 Correct 383 ms 6476 KB Output is correct
48 Correct 439 ms 6648 KB Output is correct
49 Correct 412 ms 6260 KB Output is correct
50 Correct 406 ms 6456 KB Output is correct
51 Correct 64 ms 2260 KB Output is correct
52 Correct 470 ms 6720 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 6100 KB Output is correct
2 Correct 14 ms 6100 KB Output is correct
3 Correct 3 ms 2260 KB Output is correct
4 Correct 11 ms 6228 KB Output is correct
5 Correct 25 ms 6100 KB Output is correct
6 Correct 18 ms 6224 KB Output is correct
7 Correct 14 ms 6100 KB Output is correct
8 Correct 25 ms 6100 KB Output is correct
9 Correct 17 ms 6100 KB Output is correct
10 Correct 52 ms 6152 KB Output is correct
11 Correct 53 ms 6100 KB Output is correct
12 Correct 44 ms 6184 KB Output is correct
13 Correct 42 ms 6148 KB Output is correct
14 Correct 49 ms 6100 KB Output is correct
15 Correct 50 ms 6100 KB Output is correct
16 Correct 54 ms 6100 KB Output is correct
17 Correct 34 ms 6100 KB Output is correct
18 Correct 42 ms 6100 KB Output is correct
19 Correct 46 ms 6100 KB Output is correct
20 Correct 52 ms 6100 KB Output is correct
21 Correct 111 ms 6212 KB Output is correct
22 Correct 127 ms 6204 KB Output is correct
23 Correct 76 ms 6212 KB Output is correct
24 Correct 157 ms 6204 KB Output is correct
25 Correct 137 ms 6228 KB Output is correct
26 Correct 170 ms 6204 KB Output is correct
27 Correct 170 ms 6208 KB Output is correct
28 Correct 167 ms 6216 KB Output is correct
29 Correct 173 ms 6204 KB Output is correct
30 Correct 166 ms 6092 KB Output is correct
31 Correct 166 ms 6204 KB Output is correct
32 Correct 167 ms 6212 KB Output is correct
33 Correct 162 ms 6204 KB Output is correct
34 Correct 166 ms 6204 KB Output is correct
35 Correct 146 ms 6212 KB Output is correct
36 Correct 170 ms 6208 KB Output is correct
37 Correct 322 ms 6464 KB Output is correct
38 Correct 328 ms 6460 KB Output is correct
39 Correct 401 ms 6212 KB Output is correct
40 Correct 449 ms 6476 KB Output is correct
41 Correct 436 ms 6216 KB Output is correct
42 Correct 429 ms 6468 KB Output is correct
43 Correct 431 ms 6588 KB Output is correct
44 Correct 414 ms 6592 KB Output is correct
45 Correct 431 ms 6588 KB Output is correct
46 Correct 430 ms 6212 KB Output is correct
47 Correct 383 ms 6476 KB Output is correct
48 Correct 439 ms 6648 KB Output is correct
49 Correct 412 ms 6260 KB Output is correct
50 Correct 406 ms 6456 KB Output is correct
51 Correct 64 ms 2260 KB Output is correct
52 Correct 470 ms 6720 KB Output is correct
53 Correct 405 ms 6592 KB Output is correct
54 Correct 597 ms 6596 KB Output is correct
55 Correct 611 ms 6984 KB Output is correct
56 Correct 544 ms 6596 KB Output is correct
57 Correct 630 ms 6980 KB Output is correct
58 Correct 632 ms 6732 KB Output is correct
59 Correct 603 ms 6736 KB Output is correct
60 Correct 90 ms 2260 KB Output is correct
61 Correct 615 ms 6848 KB Output is correct
62 Correct 551 ms 6856 KB Output is correct
63 Correct 566 ms 6980 KB Output is correct
64 Correct 500 ms 7040 KB Output is correct
65 Correct 529 ms 6256 KB Output is correct
66 Correct 474 ms 6372 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 6100 KB Output is correct
2 Correct 14 ms 6100 KB Output is correct
3 Correct 3 ms 2260 KB Output is correct
4 Correct 11 ms 6228 KB Output is correct
5 Correct 25 ms 6100 KB Output is correct
6 Correct 18 ms 6224 KB Output is correct
7 Correct 14 ms 6100 KB Output is correct
8 Correct 25 ms 6100 KB Output is correct
9 Correct 17 ms 6100 KB Output is correct
10 Correct 52 ms 6152 KB Output is correct
11 Correct 53 ms 6100 KB Output is correct
12 Correct 44 ms 6184 KB Output is correct
13 Correct 42 ms 6148 KB Output is correct
14 Correct 49 ms 6100 KB Output is correct
15 Correct 50 ms 6100 KB Output is correct
16 Correct 54 ms 6100 KB Output is correct
17 Correct 34 ms 6100 KB Output is correct
18 Correct 42 ms 6100 KB Output is correct
19 Correct 46 ms 6100 KB Output is correct
20 Correct 52 ms 6100 KB Output is correct
21 Correct 111 ms 6212 KB Output is correct
22 Correct 127 ms 6204 KB Output is correct
23 Correct 76 ms 6212 KB Output is correct
24 Correct 157 ms 6204 KB Output is correct
25 Correct 137 ms 6228 KB Output is correct
26 Correct 170 ms 6204 KB Output is correct
27 Correct 170 ms 6208 KB Output is correct
28 Correct 167 ms 6216 KB Output is correct
29 Correct 173 ms 6204 KB Output is correct
30 Correct 166 ms 6092 KB Output is correct
31 Correct 166 ms 6204 KB Output is correct
32 Correct 167 ms 6212 KB Output is correct
33 Correct 162 ms 6204 KB Output is correct
34 Correct 166 ms 6204 KB Output is correct
35 Correct 146 ms 6212 KB Output is correct
36 Correct 170 ms 6208 KB Output is correct
37 Correct 322 ms 6464 KB Output is correct
38 Correct 328 ms 6460 KB Output is correct
39 Correct 401 ms 6212 KB Output is correct
40 Correct 449 ms 6476 KB Output is correct
41 Correct 436 ms 6216 KB Output is correct
42 Correct 429 ms 6468 KB Output is correct
43 Correct 431 ms 6588 KB Output is correct
44 Correct 414 ms 6592 KB Output is correct
45 Correct 431 ms 6588 KB Output is correct
46 Correct 430 ms 6212 KB Output is correct
47 Correct 383 ms 6476 KB Output is correct
48 Correct 439 ms 6648 KB Output is correct
49 Correct 412 ms 6260 KB Output is correct
50 Correct 406 ms 6456 KB Output is correct
51 Correct 64 ms 2260 KB Output is correct
52 Correct 470 ms 6720 KB Output is correct
53 Correct 405 ms 6592 KB Output is correct
54 Correct 597 ms 6596 KB Output is correct
55 Correct 611 ms 6984 KB Output is correct
56 Correct 544 ms 6596 KB Output is correct
57 Correct 630 ms 6980 KB Output is correct
58 Correct 632 ms 6732 KB Output is correct
59 Correct 603 ms 6736 KB Output is correct
60 Correct 90 ms 2260 KB Output is correct
61 Correct 615 ms 6848 KB Output is correct
62 Correct 551 ms 6856 KB Output is correct
63 Correct 566 ms 6980 KB Output is correct
64 Correct 500 ms 7040 KB Output is correct
65 Correct 529 ms 6256 KB Output is correct
66 Correct 474 ms 6372 KB Output is correct
67 Correct 697 ms 6912 KB Output is correct
68 Correct 88 ms 2260 KB Output is correct
69 Correct 930 ms 7796 KB Output is correct
70 Correct 887 ms 7228 KB Output is correct
71 Correct 883 ms 7108 KB Output is correct
72 Correct 765 ms 6212 KB Output is correct
73 Correct 890 ms 6212 KB Output is correct
74 Correct 966 ms 7924 KB Output is correct
75 Correct 955 ms 7484 KB Output is correct
76 Correct 965 ms 7748 KB Output is correct
77 Correct 890 ms 7868 KB Output is correct