#pragma GCC optimize("O3", "unroll-loops")
#pragma GCC target("avx2", "popcnt")
#pragma optimize("Bismillahirrahmanirrahim")
//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█■█
//█─█─█▄─█▄─█─█─█─█
//Allahuekber
//ahmet23 orz...
//Sani buyuk Osman Pasa Plevneden cikmam diyor.
//FatihSultanMehmedHan
//YavuzSultanSelimHan
//AbdulhamidHan
#define author tolbi
#include <bits/stdc++.h>
using namespace std;
template<typename X, typename Y> istream& operator>>(istream& in, pair<X,Y> &pr) {return in>>pr.first>>pr.second;}
template<typename X, typename Y> ostream& operator<<(ostream& os, pair<X,Y> pr) {return os<<pr.first<<" "<<pr.second;}
template<typename X> istream& operator>>(istream& in, vector<X> &arr) {for(auto &it : arr) in>>it; return in;}
template<typename X> ostream& operator<<(ostream& os, vector<X> arr) {for(auto &it : arr) os<<it<<" "; return os;}
template<typename X, size_t Y> istream& operator>>(istream& in, array<X,Y> &arr) {for(auto &it : arr) in>>it; return in;}
template<typename X, size_t Y> ostream& operator<<(ostream& os, array<X,Y> arr) {for(auto &it : arr) os<<it<<" "; return os;}
#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;
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);deci(a);deci(b);
vint(arr(n));
cinarr(arr);
vector<int> pref = arr;
for (int i = 1; i < n; i++){
pref[i]+=pref[i-1];
}
function<int(int,int)> query = [&](int l, int r)->int{
int hh = 0;
if (l) hh = pref[l-1];
return pref[r]-hh;
};
int rans = 0;
int ans = 0;
vector<vector<bitset<2001>>> dp(n+1,vector<bitset<2001>>(n+1));
for (int i = a; i <= b; i++){
dp[n][n][i]=1;
}
int LOG = 40;
for (int bit = LOG-1; bit >= 0; bit--){
ans+=tol(bit);
rans+=tol(bit);
for (int l = n-1; l >= 0; l--){
for (int r = n-1; r >= l; r--){
dp[l][r]=dp[l][r+1];
if (!(query(l,r)&rans)){
dp[l][r]|=dp[r+1][r+1]>>1;
}
}
}
if (dp[0][0][0]) ans-=tol(bit);
else rans-=tol(bit);
}
cout<<ans<<endl;
}
}
Compilation message
sculpture.cpp:3: warning: ignoring '#pragma optimize ' [-Wunknown-pragmas]
3 | #pragma optimize("Bismillahirrahmanirrahim")
|
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
344 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
344 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
376 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
1 ms |
344 KB |
Output is correct |
20 |
Correct |
1 ms |
344 KB |
Output is correct |
21 |
Correct |
1 ms |
344 KB |
Output is correct |
22 |
Correct |
1 ms |
348 KB |
Output is correct |
23 |
Correct |
1 ms |
348 KB |
Output is correct |
24 |
Correct |
1 ms |
348 KB |
Output is correct |
25 |
Correct |
1 ms |
348 KB |
Output is correct |
26 |
Correct |
1 ms |
348 KB |
Output is correct |
27 |
Correct |
0 ms |
348 KB |
Output is correct |
28 |
Correct |
0 ms |
348 KB |
Output is correct |
29 |
Correct |
0 ms |
348 KB |
Output is correct |
30 |
Correct |
0 ms |
348 KB |
Output is correct |
31 |
Correct |
0 ms |
348 KB |
Output is correct |
32 |
Correct |
0 ms |
348 KB |
Output is correct |
33 |
Correct |
1 ms |
600 KB |
Output is correct |
34 |
Correct |
1 ms |
348 KB |
Output is correct |
35 |
Correct |
1 ms |
348 KB |
Output is correct |
36 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
544 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
1 ms |
348 KB |
Output is correct |
22 |
Correct |
1 ms |
344 KB |
Output is correct |
23 |
Correct |
1 ms |
348 KB |
Output is correct |
24 |
Correct |
1 ms |
348 KB |
Output is correct |
25 |
Correct |
1 ms |
348 KB |
Output is correct |
26 |
Correct |
1 ms |
348 KB |
Output is correct |
27 |
Correct |
1 ms |
348 KB |
Output is correct |
28 |
Correct |
1 ms |
604 KB |
Output is correct |
29 |
Correct |
2 ms |
604 KB |
Output is correct |
30 |
Correct |
2 ms |
860 KB |
Output is correct |
31 |
Correct |
2 ms |
1116 KB |
Output is correct |
32 |
Correct |
2 ms |
1112 KB |
Output is correct |
33 |
Correct |
2 ms |
1116 KB |
Output is correct |
34 |
Correct |
2 ms |
1116 KB |
Output is correct |
35 |
Correct |
2 ms |
860 KB |
Output is correct |
36 |
Correct |
2 ms |
1116 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
344 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
344 KB |
Output is correct |
12 |
Correct |
1 ms |
344 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
604 KB |
Output is correct |
16 |
Correct |
1 ms |
604 KB |
Output is correct |
17 |
Correct |
2 ms |
932 KB |
Output is correct |
18 |
Correct |
2 ms |
1116 KB |
Output is correct |
19 |
Correct |
3 ms |
1116 KB |
Output is correct |
20 |
Correct |
2 ms |
1116 KB |
Output is correct |
21 |
Correct |
2 ms |
1112 KB |
Output is correct |
22 |
Correct |
3 ms |
1116 KB |
Output is correct |
23 |
Correct |
2 ms |
1116 KB |
Output is correct |
24 |
Correct |
2 ms |
1116 KB |
Output is correct |
25 |
Correct |
4 ms |
1372 KB |
Output is correct |
26 |
Correct |
5 ms |
1884 KB |
Output is correct |
27 |
Correct |
7 ms |
2396 KB |
Output is correct |
28 |
Correct |
8 ms |
2908 KB |
Output is correct |
29 |
Correct |
8 ms |
2908 KB |
Output is correct |
30 |
Correct |
9 ms |
2904 KB |
Output is correct |
31 |
Correct |
8 ms |
2908 KB |
Output is correct |
32 |
Correct |
8 ms |
2908 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
420 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
360 KB |
Output is correct |
21 |
Correct |
1 ms |
612 KB |
Output is correct |
22 |
Correct |
1 ms |
360 KB |
Output is correct |
23 |
Correct |
1 ms |
360 KB |
Output is correct |
24 |
Correct |
1 ms |
348 KB |
Output is correct |
25 |
Correct |
1 ms |
344 KB |
Output is correct |
26 |
Correct |
1 ms |
568 KB |
Output is correct |
27 |
Correct |
1 ms |
348 KB |
Output is correct |
28 |
Correct |
0 ms |
348 KB |
Output is correct |
29 |
Correct |
0 ms |
348 KB |
Output is correct |
30 |
Correct |
1 ms |
348 KB |
Output is correct |
31 |
Correct |
0 ms |
348 KB |
Output is correct |
32 |
Correct |
0 ms |
348 KB |
Output is correct |
33 |
Correct |
1 ms |
348 KB |
Output is correct |
34 |
Correct |
1 ms |
344 KB |
Output is correct |
35 |
Correct |
1 ms |
348 KB |
Output is correct |
36 |
Correct |
1 ms |
348 KB |
Output is correct |
37 |
Correct |
1 ms |
348 KB |
Output is correct |
38 |
Correct |
1 ms |
604 KB |
Output is correct |
39 |
Correct |
2 ms |
600 KB |
Output is correct |
40 |
Correct |
2 ms |
860 KB |
Output is correct |
41 |
Correct |
2 ms |
860 KB |
Output is correct |
42 |
Correct |
2 ms |
1116 KB |
Output is correct |
43 |
Correct |
2 ms |
1116 KB |
Output is correct |
44 |
Correct |
2 ms |
1116 KB |
Output is correct |
45 |
Correct |
3 ms |
1116 KB |
Output is correct |
46 |
Correct |
3 ms |
860 KB |
Output is correct |
47 |
Correct |
2 ms |
1116 KB |
Output is correct |
48 |
Correct |
4 ms |
1372 KB |
Output is correct |
49 |
Correct |
5 ms |
1884 KB |
Output is correct |
50 |
Correct |
7 ms |
2396 KB |
Output is correct |
51 |
Correct |
9 ms |
2908 KB |
Output is correct |
52 |
Correct |
9 ms |
3044 KB |
Output is correct |
53 |
Correct |
9 ms |
2908 KB |
Output is correct |
54 |
Correct |
8 ms |
2908 KB |
Output is correct |
55 |
Correct |
9 ms |
2908 KB |
Output is correct |
56 |
Correct |
2 ms |
900 KB |
Output is correct |
57 |
Correct |
3 ms |
1884 KB |
Output is correct |
58 |
Correct |
4 ms |
2604 KB |
Output is correct |
59 |
Correct |
5 ms |
2908 KB |
Output is correct |
60 |
Correct |
4 ms |
3036 KB |
Output is correct |
61 |
Correct |
6 ms |
2904 KB |
Output is correct |
62 |
Correct |
5 ms |
2908 KB |
Output is correct |
63 |
Correct |
5 ms |
2908 KB |
Output is correct |
64 |
Correct |
8 ms |
2396 KB |
Output is correct |
65 |
Correct |
2 ms |
1116 KB |
Output is correct |
66 |
Correct |
2 ms |
1372 KB |
Output is correct |
67 |
Correct |
3 ms |
1884 KB |
Output is correct |
68 |
Correct |
4 ms |
2608 KB |
Output is correct |
69 |
Correct |
5 ms |
2904 KB |
Output is correct |
70 |
Correct |
4 ms |
2904 KB |
Output is correct |
71 |
Correct |
5 ms |
2908 KB |
Output is correct |
72 |
Correct |
5 ms |
2908 KB |
Output is correct |
73 |
Correct |
6 ms |
2908 KB |
Output is correct |
74 |
Correct |
5 ms |
2904 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
600 KB |
Output is correct |
12 |
Correct |
1 ms |
344 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
344 KB |
Output is correct |
19 |
Correct |
1 ms |
344 KB |
Output is correct |
20 |
Correct |
1 ms |
344 KB |
Output is correct |
21 |
Correct |
1 ms |
344 KB |
Output is correct |
22 |
Correct |
1 ms |
348 KB |
Output is correct |
23 |
Correct |
1 ms |
348 KB |
Output is correct |
24 |
Correct |
1 ms |
600 KB |
Output is correct |
25 |
Correct |
1 ms |
604 KB |
Output is correct |
26 |
Correct |
1 ms |
604 KB |
Output is correct |
27 |
Correct |
2 ms |
860 KB |
Output is correct |
28 |
Correct |
3 ms |
1112 KB |
Output is correct |
29 |
Correct |
2 ms |
1116 KB |
Output is correct |
30 |
Correct |
2 ms |
1116 KB |
Output is correct |
31 |
Correct |
3 ms |
1116 KB |
Output is correct |
32 |
Correct |
3 ms |
1112 KB |
Output is correct |
33 |
Correct |
3 ms |
1116 KB |
Output is correct |
34 |
Correct |
2 ms |
1116 KB |
Output is correct |
35 |
Correct |
4 ms |
1372 KB |
Output is correct |
36 |
Correct |
5 ms |
1884 KB |
Output is correct |
37 |
Correct |
7 ms |
2608 KB |
Output is correct |
38 |
Correct |
8 ms |
2908 KB |
Output is correct |
39 |
Correct |
8 ms |
2904 KB |
Output is correct |
40 |
Correct |
9 ms |
2908 KB |
Output is correct |
41 |
Correct |
8 ms |
2904 KB |
Output is correct |
42 |
Correct |
8 ms |
2908 KB |
Output is correct |
43 |
Correct |
2 ms |
1116 KB |
Output is correct |
44 |
Correct |
3 ms |
1884 KB |
Output is correct |
45 |
Correct |
4 ms |
2392 KB |
Output is correct |
46 |
Correct |
4 ms |
2908 KB |
Output is correct |
47 |
Correct |
5 ms |
2908 KB |
Output is correct |
48 |
Correct |
4 ms |
2908 KB |
Output is correct |
49 |
Correct |
5 ms |
2980 KB |
Output is correct |
50 |
Correct |
5 ms |
2908 KB |
Output is correct |
51 |
Correct |
5 ms |
2908 KB |
Output is correct |
52 |
Correct |
225 ms |
86028 KB |
Output is correct |
53 |
Correct |
375 ms |
141376 KB |
Output is correct |
54 |
Correct |
669 ms |
252980 KB |
Output is correct |
55 |
Correct |
648 ms |
253268 KB |
Output is correct |
56 |
Runtime error |
106 ms |
262144 KB |
Execution killed with signal 9 |
57 |
Halted |
0 ms |
0 KB |
- |