#include <bits/stdc++.h>
#include <math.h>
#include <chrono>
using namespace std;
#pragma GCC optimize("-O3")
#define endl "\n"
#define mp make_pair
#define st first
#define nd second
#define pii pair<int, int>
#define pb push_back
#define _upgrade ios_base::sync_with_stdio(0), cout.setf(ios::fixed), cout.precision(10) //cin.tie(0); cout.tie(0);
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define FWD(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define fwd(i, a, b) for (int i = (a); i < (b); ++i)
#define all(c) (c).begin(), (c).end()
#define what(x) cerr << #x << " is " << x << endl;
#define int long long
const int MAXN = 2e3 + 10;
const int MAXK = 44; //UWAGA
unsigned int E[MAXN][MAXN];
int n, a, b;
int tab[MAXN];
pii dist[MAXN];
unsigned int wynik = 0;
unsigned int niewynik;
void mini(pii A, pii &B)
{
B.st = min(B.st, A.st + 1);
B.nd = max(B.nd, A.nd + 1);
}
void solve(const int l)
{
//cerr << "patrze na: " << l << endl;
niewynik = ~wynik;
fill(dist, dist + MAXN, mp(100000, -100000));
dist[0] = {0, 0};
rep(i, n) for (int k = i + 1; k <= n; k++)
{
// cerr << i << " " << k << " " << E[i][k] << " " << (E[i][k] & niewynik) << " " << ((E[i][k] & niewynik) < (1 << l)) << endl;
if ((E[i][k] & niewynik) < (1ll << l))
mini(dist[i], dist[k]);
}
// cerr << dist[n].st << " " << dist[n].nd << endl;
if (!(dist[n].st <= b && dist[n].nd >= a))
wynik += (1ll << l);
}
void pre()
{
cin >> n >> a >> b;
rep(i, n) cin >> tab[i];
rep(i, n)
{
int val = tab[i];
for (int k = i + 1; k <= n; k++)
{
E[i][k] = val;
val += tab[k];
}
}
}
main()
{
_upgrade;
pre();
for (int k = MAXK; k >= 0; k--)
solve(k);
cout << wynik << endl;
}
Compilation message
sculpture.cpp: In function 'void solve(long long int)':
sculpture.cpp:47:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if ((E[i][k] & niewynik) < (1ll << l))
~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
sculpture.cpp: At global scope:
sculpture.cpp:71:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
main()
^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
380 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
504 KB |
Output is correct |
7 |
Correct |
2 ms |
504 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
9 |
Correct |
2 ms |
376 KB |
Output is correct |
10 |
Correct |
2 ms |
504 KB |
Output is correct |
11 |
Correct |
2 ms |
376 KB |
Output is correct |
12 |
Correct |
3 ms |
376 KB |
Output is correct |
13 |
Correct |
3 ms |
504 KB |
Output is correct |
14 |
Correct |
2 ms |
376 KB |
Output is correct |
15 |
Correct |
3 ms |
376 KB |
Output is correct |
16 |
Correct |
2 ms |
376 KB |
Output is correct |
17 |
Correct |
2 ms |
376 KB |
Output is correct |
18 |
Correct |
3 ms |
376 KB |
Output is correct |
19 |
Correct |
3 ms |
504 KB |
Output is correct |
20 |
Correct |
2 ms |
376 KB |
Output is correct |
21 |
Correct |
2 ms |
504 KB |
Output is correct |
22 |
Correct |
2 ms |
504 KB |
Output is correct |
23 |
Correct |
2 ms |
380 KB |
Output is correct |
24 |
Correct |
2 ms |
376 KB |
Output is correct |
25 |
Correct |
2 ms |
504 KB |
Output is correct |
26 |
Correct |
3 ms |
376 KB |
Output is correct |
27 |
Correct |
2 ms |
376 KB |
Output is correct |
28 |
Correct |
2 ms |
376 KB |
Output is correct |
29 |
Correct |
2 ms |
376 KB |
Output is correct |
30 |
Correct |
2 ms |
376 KB |
Output is correct |
31 |
Correct |
2 ms |
504 KB |
Output is correct |
32 |
Correct |
2 ms |
504 KB |
Output is correct |
33 |
Correct |
2 ms |
504 KB |
Output is correct |
34 |
Correct |
2 ms |
504 KB |
Output is correct |
35 |
Correct |
2 ms |
376 KB |
Output is correct |
36 |
Correct |
2 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
3 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
504 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
9 |
Correct |
2 ms |
504 KB |
Output is correct |
10 |
Correct |
2 ms |
504 KB |
Output is correct |
11 |
Correct |
3 ms |
504 KB |
Output is correct |
12 |
Correct |
2 ms |
376 KB |
Output is correct |
13 |
Correct |
2 ms |
380 KB |
Output is correct |
14 |
Correct |
2 ms |
376 KB |
Output is correct |
15 |
Correct |
2 ms |
376 KB |
Output is correct |
16 |
Correct |
3 ms |
376 KB |
Output is correct |
17 |
Correct |
2 ms |
376 KB |
Output is correct |
18 |
Correct |
2 ms |
376 KB |
Output is correct |
19 |
Correct |
2 ms |
504 KB |
Output is correct |
20 |
Correct |
2 ms |
504 KB |
Output is correct |
21 |
Correct |
2 ms |
504 KB |
Output is correct |
22 |
Correct |
2 ms |
504 KB |
Output is correct |
23 |
Correct |
2 ms |
504 KB |
Output is correct |
24 |
Correct |
2 ms |
504 KB |
Output is correct |
25 |
Correct |
2 ms |
504 KB |
Output is correct |
26 |
Correct |
2 ms |
380 KB |
Output is correct |
27 |
Correct |
2 ms |
504 KB |
Output is correct |
28 |
Correct |
2 ms |
504 KB |
Output is correct |
29 |
Correct |
3 ms |
504 KB |
Output is correct |
30 |
Correct |
2 ms |
504 KB |
Output is correct |
31 |
Correct |
2 ms |
632 KB |
Output is correct |
32 |
Correct |
3 ms |
632 KB |
Output is correct |
33 |
Correct |
2 ms |
632 KB |
Output is correct |
34 |
Correct |
3 ms |
632 KB |
Output is correct |
35 |
Correct |
3 ms |
632 KB |
Output is correct |
36 |
Correct |
3 ms |
632 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
416 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
384 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
9 |
Correct |
2 ms |
376 KB |
Output is correct |
10 |
Correct |
2 ms |
376 KB |
Output is correct |
11 |
Correct |
2 ms |
376 KB |
Output is correct |
12 |
Correct |
2 ms |
376 KB |
Output is correct |
13 |
Correct |
2 ms |
376 KB |
Output is correct |
14 |
Correct |
2 ms |
376 KB |
Output is correct |
15 |
Correct |
2 ms |
504 KB |
Output is correct |
16 |
Correct |
2 ms |
508 KB |
Output is correct |
17 |
Correct |
2 ms |
632 KB |
Output is correct |
18 |
Correct |
2 ms |
504 KB |
Output is correct |
19 |
Correct |
2 ms |
632 KB |
Output is correct |
20 |
Correct |
3 ms |
504 KB |
Output is correct |
21 |
Correct |
2 ms |
632 KB |
Output is correct |
22 |
Correct |
2 ms |
632 KB |
Output is correct |
23 |
Correct |
2 ms |
632 KB |
Output is correct |
24 |
Correct |
2 ms |
632 KB |
Output is correct |
25 |
Correct |
3 ms |
632 KB |
Output is correct |
26 |
Correct |
3 ms |
636 KB |
Output is correct |
27 |
Correct |
3 ms |
760 KB |
Output is correct |
28 |
Correct |
3 ms |
888 KB |
Output is correct |
29 |
Correct |
3 ms |
760 KB |
Output is correct |
30 |
Correct |
3 ms |
760 KB |
Output is correct |
31 |
Correct |
3 ms |
888 KB |
Output is correct |
32 |
Correct |
3 ms |
808 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
532 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
2 ms |
504 KB |
Output is correct |
9 |
Correct |
2 ms |
376 KB |
Output is correct |
10 |
Correct |
2 ms |
376 KB |
Output is correct |
11 |
Correct |
2 ms |
508 KB |
Output is correct |
12 |
Correct |
2 ms |
376 KB |
Output is correct |
13 |
Correct |
2 ms |
504 KB |
Output is correct |
14 |
Correct |
2 ms |
376 KB |
Output is correct |
15 |
Correct |
2 ms |
376 KB |
Output is correct |
16 |
Correct |
2 ms |
376 KB |
Output is correct |
17 |
Correct |
2 ms |
376 KB |
Output is correct |
18 |
Correct |
2 ms |
376 KB |
Output is correct |
19 |
Correct |
2 ms |
376 KB |
Output is correct |
20 |
Correct |
2 ms |
376 KB |
Output is correct |
21 |
Correct |
2 ms |
504 KB |
Output is correct |
22 |
Correct |
2 ms |
504 KB |
Output is correct |
23 |
Correct |
2 ms |
376 KB |
Output is correct |
24 |
Correct |
2 ms |
504 KB |
Output is correct |
25 |
Correct |
2 ms |
504 KB |
Output is correct |
26 |
Correct |
2 ms |
376 KB |
Output is correct |
27 |
Correct |
2 ms |
376 KB |
Output is correct |
28 |
Correct |
2 ms |
376 KB |
Output is correct |
29 |
Correct |
2 ms |
376 KB |
Output is correct |
30 |
Correct |
2 ms |
504 KB |
Output is correct |
31 |
Correct |
2 ms |
504 KB |
Output is correct |
32 |
Correct |
2 ms |
376 KB |
Output is correct |
33 |
Correct |
2 ms |
504 KB |
Output is correct |
34 |
Correct |
2 ms |
504 KB |
Output is correct |
35 |
Correct |
3 ms |
504 KB |
Output is correct |
36 |
Correct |
3 ms |
376 KB |
Output is correct |
37 |
Correct |
3 ms |
504 KB |
Output is correct |
38 |
Correct |
2 ms |
504 KB |
Output is correct |
39 |
Correct |
2 ms |
504 KB |
Output is correct |
40 |
Correct |
2 ms |
504 KB |
Output is correct |
41 |
Correct |
2 ms |
636 KB |
Output is correct |
42 |
Correct |
2 ms |
636 KB |
Output is correct |
43 |
Correct |
2 ms |
632 KB |
Output is correct |
44 |
Correct |
2 ms |
632 KB |
Output is correct |
45 |
Correct |
3 ms |
632 KB |
Output is correct |
46 |
Correct |
2 ms |
548 KB |
Output is correct |
47 |
Correct |
2 ms |
632 KB |
Output is correct |
48 |
Correct |
3 ms |
632 KB |
Output is correct |
49 |
Correct |
3 ms |
760 KB |
Output is correct |
50 |
Correct |
3 ms |
760 KB |
Output is correct |
51 |
Correct |
3 ms |
760 KB |
Output is correct |
52 |
Correct |
3 ms |
888 KB |
Output is correct |
53 |
Correct |
3 ms |
888 KB |
Output is correct |
54 |
Correct |
3 ms |
888 KB |
Output is correct |
55 |
Correct |
3 ms |
760 KB |
Output is correct |
56 |
Correct |
2 ms |
504 KB |
Output is correct |
57 |
Correct |
3 ms |
760 KB |
Output is correct |
58 |
Correct |
3 ms |
760 KB |
Output is correct |
59 |
Correct |
3 ms |
760 KB |
Output is correct |
60 |
Correct |
3 ms |
760 KB |
Output is correct |
61 |
Correct |
3 ms |
800 KB |
Output is correct |
62 |
Correct |
3 ms |
760 KB |
Output is correct |
63 |
Correct |
3 ms |
888 KB |
Output is correct |
64 |
Correct |
3 ms |
760 KB |
Output is correct |
65 |
Correct |
2 ms |
632 KB |
Output is correct |
66 |
Correct |
2 ms |
632 KB |
Output is correct |
67 |
Correct |
3 ms |
632 KB |
Output is correct |
68 |
Correct |
3 ms |
760 KB |
Output is correct |
69 |
Correct |
3 ms |
760 KB |
Output is correct |
70 |
Correct |
3 ms |
760 KB |
Output is correct |
71 |
Correct |
3 ms |
888 KB |
Output is correct |
72 |
Correct |
3 ms |
888 KB |
Output is correct |
73 |
Correct |
3 ms |
760 KB |
Output is correct |
74 |
Correct |
3 ms |
888 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
420 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
9 |
Correct |
2 ms |
504 KB |
Output is correct |
10 |
Correct |
2 ms |
504 KB |
Output is correct |
11 |
Correct |
2 ms |
504 KB |
Output is correct |
12 |
Correct |
2 ms |
504 KB |
Output is correct |
13 |
Correct |
2 ms |
504 KB |
Output is correct |
14 |
Correct |
2 ms |
424 KB |
Output is correct |
15 |
Correct |
2 ms |
376 KB |
Output is correct |
16 |
Correct |
2 ms |
504 KB |
Output is correct |
17 |
Correct |
2 ms |
376 KB |
Output is correct |
18 |
Correct |
2 ms |
504 KB |
Output is correct |
19 |
Correct |
2 ms |
376 KB |
Output is correct |
20 |
Correct |
2 ms |
504 KB |
Output is correct |
21 |
Correct |
2 ms |
376 KB |
Output is correct |
22 |
Correct |
2 ms |
504 KB |
Output is correct |
23 |
Correct |
2 ms |
504 KB |
Output is correct |
24 |
Correct |
2 ms |
504 KB |
Output is correct |
25 |
Correct |
2 ms |
504 KB |
Output is correct |
26 |
Correct |
2 ms |
504 KB |
Output is correct |
27 |
Correct |
2 ms |
504 KB |
Output is correct |
28 |
Correct |
2 ms |
632 KB |
Output is correct |
29 |
Correct |
2 ms |
504 KB |
Output is correct |
30 |
Correct |
2 ms |
632 KB |
Output is correct |
31 |
Correct |
3 ms |
632 KB |
Output is correct |
32 |
Correct |
2 ms |
632 KB |
Output is correct |
33 |
Correct |
3 ms |
632 KB |
Output is correct |
34 |
Correct |
2 ms |
632 KB |
Output is correct |
35 |
Correct |
2 ms |
632 KB |
Output is correct |
36 |
Correct |
3 ms |
632 KB |
Output is correct |
37 |
Correct |
3 ms |
760 KB |
Output is correct |
38 |
Correct |
3 ms |
888 KB |
Output is correct |
39 |
Correct |
3 ms |
888 KB |
Output is correct |
40 |
Correct |
3 ms |
760 KB |
Output is correct |
41 |
Correct |
3 ms |
760 KB |
Output is correct |
42 |
Correct |
3 ms |
760 KB |
Output is correct |
43 |
Correct |
2 ms |
632 KB |
Output is correct |
44 |
Correct |
3 ms |
672 KB |
Output is correct |
45 |
Correct |
3 ms |
764 KB |
Output is correct |
46 |
Correct |
3 ms |
888 KB |
Output is correct |
47 |
Correct |
3 ms |
888 KB |
Output is correct |
48 |
Correct |
3 ms |
760 KB |
Output is correct |
49 |
Correct |
3 ms |
764 KB |
Output is correct |
50 |
Correct |
3 ms |
760 KB |
Output is correct |
51 |
Correct |
3 ms |
888 KB |
Output is correct |
52 |
Correct |
16 ms |
3960 KB |
Output is correct |
53 |
Correct |
25 ms |
5624 KB |
Output is correct |
54 |
Correct |
43 ms |
8312 KB |
Output is correct |
55 |
Correct |
41 ms |
8312 KB |
Output is correct |
56 |
Correct |
152 ms |
23032 KB |
Output is correct |
57 |
Correct |
152 ms |
23288 KB |
Output is correct |
58 |
Correct |
161 ms |
23160 KB |
Output is correct |
59 |
Correct |
161 ms |
23160 KB |
Output is correct |
60 |
Correct |
177 ms |
23192 KB |
Output is correct |
61 |
Correct |
3 ms |
888 KB |
Output is correct |
62 |
Correct |
25 ms |
5496 KB |
Output is correct |
63 |
Correct |
43 ms |
8312 KB |
Output is correct |
64 |
Correct |
41 ms |
8368 KB |
Output is correct |
65 |
Correct |
74 ms |
13816 KB |
Output is correct |
66 |
Correct |
116 ms |
19064 KB |
Output is correct |
67 |
Correct |
167 ms |
23260 KB |
Output is correct |
68 |
Correct |
169 ms |
23160 KB |
Output is correct |
69 |
Correct |
160 ms |
23152 KB |
Output is correct |