# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
686755 | 2023-01-25T22:42:00 Z | tolbi | Bootfall (IZhO17_bootfall) | C++17 | 739 ms | 39504 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(2500001,0); ansarr[0]=1; for (int j = 0; j < n; j++){ for (int i = ansarr.size()-1; i >= arr[j]; i--){ ansarr[i]+=ansarr[i-arr[j]]; } } int sum = 0; for (int i = 0; i < n; ++i) { sum+=arr[i]; } if (sum%2 || ansarr[sum/2]==0){ cout<<0<<endl; continue; } vector<int> kk(2500001,0); for (int i = 0; i < n; i++){ for (int j = arr[i]; j < ansarr.size(); j++){ ansarr[j]-=ansarr[j-arr[i]]; } for (int j = 0; j < ansarr.size(); j++){ int hueh = sum-arr[i]-j*2; if (hueh<0) continue; if (ansarr[j]>0) kk[hueh]++; } for (int j = ansarr.size()-1; j >= arr[i]; j--){ ansarr[j]+=ansarr[j-arr[i]]; } } 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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 67 ms | 39396 KB | Output is correct |
2 | Correct | 79 ms | 39356 KB | Output is correct |
3 | Correct | 16 ms | 19796 KB | Output is correct |
4 | Correct | 63 ms | 39452 KB | Output is correct |
5 | Correct | 140 ms | 39504 KB | Output is correct |
6 | Correct | 99 ms | 39372 KB | Output is correct |
7 | Correct | 78 ms | 39456 KB | Output is correct |
8 | Correct | 138 ms | 39448 KB | Output is correct |
9 | Correct | 115 ms | 39348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 67 ms | 39396 KB | Output is correct |
2 | Correct | 79 ms | 39356 KB | Output is correct |
3 | Correct | 16 ms | 19796 KB | Output is correct |
4 | Correct | 63 ms | 39452 KB | Output is correct |
5 | Correct | 140 ms | 39504 KB | Output is correct |
6 | Correct | 99 ms | 39372 KB | Output is correct |
7 | Correct | 78 ms | 39456 KB | Output is correct |
8 | Correct | 138 ms | 39448 KB | Output is correct |
9 | Correct | 115 ms | 39348 KB | Output is correct |
10 | Correct | 307 ms | 39384 KB | Output is correct |
11 | Correct | 322 ms | 39340 KB | Output is correct |
12 | Correct | 314 ms | 39336 KB | Output is correct |
13 | Correct | 273 ms | 39452 KB | Output is correct |
14 | Correct | 298 ms | 39340 KB | Output is correct |
15 | Correct | 310 ms | 39500 KB | Output is correct |
16 | Correct | 317 ms | 39332 KB | Output is correct |
17 | Correct | 198 ms | 39452 KB | Output is correct |
18 | Correct | 272 ms | 39336 KB | Output is correct |
19 | Correct | 276 ms | 39336 KB | Output is correct |
20 | Correct | 325 ms | 39340 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 67 ms | 39396 KB | Output is correct |
2 | Correct | 79 ms | 39356 KB | Output is correct |
3 | Correct | 16 ms | 19796 KB | Output is correct |
4 | Correct | 63 ms | 39452 KB | Output is correct |
5 | Correct | 140 ms | 39504 KB | Output is correct |
6 | Correct | 99 ms | 39372 KB | Output is correct |
7 | Correct | 78 ms | 39456 KB | Output is correct |
8 | Correct | 138 ms | 39448 KB | Output is correct |
9 | Correct | 115 ms | 39348 KB | Output is correct |
10 | Correct | 307 ms | 39384 KB | Output is correct |
11 | Correct | 322 ms | 39340 KB | Output is correct |
12 | Correct | 314 ms | 39336 KB | Output is correct |
13 | Correct | 273 ms | 39452 KB | Output is correct |
14 | Correct | 298 ms | 39340 KB | Output is correct |
15 | Correct | 310 ms | 39500 KB | Output is correct |
16 | Correct | 317 ms | 39332 KB | Output is correct |
17 | Correct | 198 ms | 39452 KB | Output is correct |
18 | Correct | 272 ms | 39336 KB | Output is correct |
19 | Correct | 276 ms | 39336 KB | Output is correct |
20 | Correct | 325 ms | 39340 KB | Output is correct |
21 | Correct | 634 ms | 39452 KB | Output is correct |
22 | Incorrect | 739 ms | 39484 KB | Output isn't correct |
23 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 67 ms | 39396 KB | Output is correct |
2 | Correct | 79 ms | 39356 KB | Output is correct |
3 | Correct | 16 ms | 19796 KB | Output is correct |
4 | Correct | 63 ms | 39452 KB | Output is correct |
5 | Correct | 140 ms | 39504 KB | Output is correct |
6 | Correct | 99 ms | 39372 KB | Output is correct |
7 | Correct | 78 ms | 39456 KB | Output is correct |
8 | Correct | 138 ms | 39448 KB | Output is correct |
9 | Correct | 115 ms | 39348 KB | Output is correct |
10 | Correct | 307 ms | 39384 KB | Output is correct |
11 | Correct | 322 ms | 39340 KB | Output is correct |
12 | Correct | 314 ms | 39336 KB | Output is correct |
13 | Correct | 273 ms | 39452 KB | Output is correct |
14 | Correct | 298 ms | 39340 KB | Output is correct |
15 | Correct | 310 ms | 39500 KB | Output is correct |
16 | Correct | 317 ms | 39332 KB | Output is correct |
17 | Correct | 198 ms | 39452 KB | Output is correct |
18 | Correct | 272 ms | 39336 KB | Output is correct |
19 | Correct | 276 ms | 39336 KB | Output is correct |
20 | Correct | 325 ms | 39340 KB | Output is correct |
21 | Correct | 634 ms | 39452 KB | Output is correct |
22 | Incorrect | 739 ms | 39484 KB | Output isn't correct |
23 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 67 ms | 39396 KB | Output is correct |
2 | Correct | 79 ms | 39356 KB | Output is correct |
3 | Correct | 16 ms | 19796 KB | Output is correct |
4 | Correct | 63 ms | 39452 KB | Output is correct |
5 | Correct | 140 ms | 39504 KB | Output is correct |
6 | Correct | 99 ms | 39372 KB | Output is correct |
7 | Correct | 78 ms | 39456 KB | Output is correct |
8 | Correct | 138 ms | 39448 KB | Output is correct |
9 | Correct | 115 ms | 39348 KB | Output is correct |
10 | Correct | 307 ms | 39384 KB | Output is correct |
11 | Correct | 322 ms | 39340 KB | Output is correct |
12 | Correct | 314 ms | 39336 KB | Output is correct |
13 | Correct | 273 ms | 39452 KB | Output is correct |
14 | Correct | 298 ms | 39340 KB | Output is correct |
15 | Correct | 310 ms | 39500 KB | Output is correct |
16 | Correct | 317 ms | 39332 KB | Output is correct |
17 | Correct | 198 ms | 39452 KB | Output is correct |
18 | Correct | 272 ms | 39336 KB | Output is correct |
19 | Correct | 276 ms | 39336 KB | Output is correct |
20 | Correct | 325 ms | 39340 KB | Output is correct |
21 | Correct | 634 ms | 39452 KB | Output is correct |
22 | Incorrect | 739 ms | 39484 KB | Output isn't correct |
23 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 67 ms | 39396 KB | Output is correct |
2 | Correct | 79 ms | 39356 KB | Output is correct |
3 | Correct | 16 ms | 19796 KB | Output is correct |
4 | Correct | 63 ms | 39452 KB | Output is correct |
5 | Correct | 140 ms | 39504 KB | Output is correct |
6 | Correct | 99 ms | 39372 KB | Output is correct |
7 | Correct | 78 ms | 39456 KB | Output is correct |
8 | Correct | 138 ms | 39448 KB | Output is correct |
9 | Correct | 115 ms | 39348 KB | Output is correct |
10 | Correct | 307 ms | 39384 KB | Output is correct |
11 | Correct | 322 ms | 39340 KB | Output is correct |
12 | Correct | 314 ms | 39336 KB | Output is correct |
13 | Correct | 273 ms | 39452 KB | Output is correct |
14 | Correct | 298 ms | 39340 KB | Output is correct |
15 | Correct | 310 ms | 39500 KB | Output is correct |
16 | Correct | 317 ms | 39332 KB | Output is correct |
17 | Correct | 198 ms | 39452 KB | Output is correct |
18 | Correct | 272 ms | 39336 KB | Output is correct |
19 | Correct | 276 ms | 39336 KB | Output is correct |
20 | Correct | 325 ms | 39340 KB | Output is correct |
21 | Correct | 634 ms | 39452 KB | Output is correct |
22 | Incorrect | 739 ms | 39484 KB | Output isn't correct |
23 | Halted | 0 ms | 0 KB | - |